/**
 * Created by Loin on 14-4-15.
 * 合并了如下文件
 * - /js/swfobject.js
 * - /js/plugins/plupload.full.min.js
 * - /js/plugins.js
 * - /js/smooth.js
 * - /js/mfw.js
 * - /js/common.js
 */
/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
 Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
 This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
 */
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />';}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();
/**
 * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
 * v1.2.1
 * update by LiQin
 * 修复html5 prophoto rgb失真
 * Copyright 2013, Moxiecode Systems AB
 * Released under GPL License.
 *
 * License: http://www.plupload.com/license
 * Contributing: http://www.plupload.com/contributing
 *
 * Date: 2014-05-14
 */
(function(e,t){"use strict";function r(e,t){var r,i=[];for(var s=0;s<e.length;++s){r=n[e[s]]||o(e[s]);if(!r){throw"module definition dependecy not found: "+e[s]}i.push(r)}t.apply(null,i)}function i(e,i,s){if(typeof e!=="string"){throw"invalid module definition, module id must be defined and be a string"}if(i===t){throw"invalid module definition, dependencies must be specified"}if(s===t){throw"invalid module definition, definition function must be specified"}r(i,function(){n[e]=s.apply(null,arguments)})}function s(e){return!!n[e]}function o(t){var n=e;var r=t.split(/[.\/]/);for(var i=0;i<r.length;++i){if(!n[r[i]]){return}n=n[r[i]]}return n}function u(r){for(var i=0;i<r.length;i++){var s=e;var o=r[i];var u=o.split(/[.\/]/);for(var a=0;a<u.length-1;++a){if(s[u[a]]===t){s[u[a]]={}}s=s[u[a]]}s[u[u.length-1]]=n[o]}}var n={};i("moxie/core/utils/Basic",[],function(){var e=function(e){var t;if(e===t){return"undefined"}else if(e===null){return"null"}else if(e.nodeType){return"node"}return{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};var t=function(r){var i;n(arguments,function(s,u){if(u>0){n(s,function(n,s){if(n!==i){if(e(r[s])===e(n)&&!!~o(e(n),["array","object"])){t(r[s],n)}else{r[s]=n}}})}});return r};var n=function(e,t){var n,r,i,s;if(e){try{n=e.length}catch(o){n=s}if(n===s){for(r in e){if(e.hasOwnProperty(r)){if(t(e[r],r)===false){return}}}}else{for(i=0;i<n;i++){if(t(e[i],i)===false){return}}}}};var r=function(t){var n;if(!t||e(t)!=="object"){return true}for(n in t){return false}return true};var i=function(t,n){function s(r){if(e(t[r])==="function"){t[r](function(e){++r<i&&!e?s(r):n(e)})}}var r=0,i=t.length;if(e(n)!=="function"){n=function(){}}if(!t||!t.length){n()}s(r)};var s=function(e,t){var r=0,i=e.length,s=new Array(i);n(e,function(e,n){e(function(e){if(e){return t(e)}var o=[].slice.call(arguments);o.shift();s[n]=o;r++;if(r===i){s.unshift(null);t.apply(this,s)}})})};var o=function(e,t){if(t){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(t,e)}for(var n=0,r=t.length;n<r;n++){if(t[n]===e){return n}}}return-1};var u=function(t,n){var r=[];if(e(t)!=="array"){t=[t]}if(e(n)!=="array"){n=[n]}for(var i in t){if(o(t[i],n)===-1){r.push(t[i])}}return r.length?r:false};var a=function(e,t){var r=[];n(e,function(e){if(o(e,t)!==-1){r.push(e)}});return r.length?r:null};var f=function(e){var t,n=[];for(t=0;t<e.length;t++){n[t]=e[t]}return n};var l=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),r;for(r=0;r<5;r++){n+=Math.floor(Math.random()*65535).toString(32)}return(t||"o_")+n+(e++).toString(32)}}();var c=function(e){if(!e){return e}return String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,"")};var h=function(e){if(typeof e!=="string"){return e}var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,""));n=e[2];e=+e[1];if(t.hasOwnProperty(n)){e*=t[n]}return e};return{guid:l,typeOf:e,extend:t,each:n,isEmptyObj:r,inSeries:i,inParallel:s,inArray:o,arrayDiff:u,arrayIntersect:a,toArray:f,trim:c,parseSizeStr:h}});i("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return e.typeOf(t)!=="undefined"?t:""})}}});i("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var n=""+"application/msword,doc dot,"+"application/pdf,pdf,"+"application/pgp-signature,pgp,"+"application/postscript,ps ai eps,"+"application/rtf,rtf,"+"application/vnd.ms-excel,xls xlb,"+"application/vnd.ms-powerpoint,ppt pps pot,"+"application/zip,zip,"+"application/x-shockwave-flash,swf swfl,"+"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,"+"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,"+"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,"+"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,"+"application/vnd.openxmlformats-officedocument.presentationml.template,potx,"+"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,"+"application/x-javascript,js,"+"application/json,json,"+"audio/mpeg,mp3 mpga mpega mp2,"+"audio/x-wav,wav,"+"audio/x-m4a,m4a,"+"audio/ogg,oga ogg,"+"audio/aiff,aiff aif,"+"audio/flac,flac,"+"audio/aac,aac,"+"audio/ac3,ac3,"+"audio/x-ms-wma,wma,"+"image/bmp,bmp,"+"image/gif,gif,"+"image/jpeg,jpg jpeg jpe,"+"image/photoshop,psd,"+"image/png,png,"+"image/svg+xml,svg svgz,"+"image/tiff,tiff tif,"+"text/plain,asc txt text diff log,"+"text/html,htm html xhtml,"+"text/css,css,"+"text/csv,csv,"+"text/rtf,rtf,"+"video/mpeg,mpeg mpg mpe m2v,"+"video/quicktime,qt mov,"+"video/mp4,mp4,"+"video/x-m4v,m4v,"+"video/x-flv,flv,"+"video/x-ms-wmv,wmv,"+"video/avi,avi,"+"video/webm,webm,"+"video/3gpp,3gpp 3gp,"+"video/3gpp2,3g2,"+"video/vnd.rn-realvideo,rv,"+"video/ogg,ogv,"+"video/x-matroska,mkv,"+"application/vnd.oasis.opendocument.formula-template,otf,"+"application/octet-stream,exe";var r={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,r,i;for(n=0;n<t.length;n+=2){i=t[n+1].split(/ /);for(r=0;r<i.length;r++){this.mimes[i[r]]=t[n]}this.extensions[t[n]]=i}},extList2mimes:function(t,n){var r=this,i,s,o,u,a=[];for(s=0;s<t.length;s++){i=t[s].extensions.split(/\s*,\s*/);for(o=0;o<i.length;o++){if(i[o]==="*"){return[]}u=r.mimes[i[o]];if(!u){if(n&&/^\w+$/.test(i[o])){a.push("."+i[o])}else{return[]}}else if(e.inArray(u,a)===-1){a.push(u)}}}return a},mimes2exts:function(t){var n=this,r=[];e.each(t,function(t){if(t==="*"){r=[];return false}var i=t.match(/^(\w+)\/(\*|\w+)$/);if(i){if(i[2]==="*"){e.each(n.extensions,function(e,t){if((new RegExp("^"+i[1]+"/")).test(t)){[].push.apply(r,n.extensions[t])}})}else if(n.extensions[t]){[].push.apply(r,n.extensions[t])}}});return r},mimes2extList:function(n){var r=[],i=[];if(e.typeOf(n)==="string"){n=e.trim(n).split(/\s*,\s*/)}i=this.mimes2exts(n);r.push({title:t.translate("Files"),extensions:i.length?i.join(","):"*"});r.mimes=n;return r},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);if(t){return t[1].toLowerCase()}return""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};r.addMimeType(n);return r});i("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function n(e,t,n){var r=0,i=0,s=0,o={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},u=function(e){e=(""+e).replace(/[_\-+]/g,".");e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return!e.length?[-8]:e.split(".")},a=function(e){return!e?0:isNaN(e)?o[e]||-7:parseInt(e,10)};e=u(e);t=u(t);i=Math.max(e.length,t.length);for(r=0;r<i;r++){if(e[r]==t[r]){continue}e[r]=a(e[r]);t[r]=a(t[r]);if(e[r]<t[r]){s=-1;break}else if(e[r]>t[r]){s=1;break}}if(!n){return s}switch(n){case">":case"gt":return s>0;case">=":case"ge":return s>=0;case"<=":case"le":return s<=0;case"==":case"=":case"eq":return s===0;case"<>":case"!=":case"ne":return s!==0;case"":case"<":case"lt":return s<0;default:return null}}var t=function(e){var t="",n="?",r="function",i="undefined",s="object",o="major",u="model",a="name",f="type",l="vendor",c="version",h="architecture",p="console",d="mobile",v="tablet";var m={has:function(e,t){return t.toLowerCase().indexOf(e.toLowerCase())!==-1},lowerize:function(e){return e.toLowerCase()}};var g={rgx:function(){for(var t,n=0,o,u,a,f,l,c,h=arguments;n<h.length;n+=2){var p=h[n],d=h[n+1];if(typeof t===i){t={};for(a in d){f=d[a];if(typeof f===s){t[f[0]]=e}else{t[f]=e}}}for(o=u=0;o<p.length;o++){l=p[o].exec(this.getUA());if(!!l){for(a=0;a<d.length;a++){c=l[++u];f=d[a];if(typeof f===s&&f.length>0){if(f.length==2){if(typeof f[1]==r){t[f[0]]=f[1].call(this,c)}else{t[f[0]]=f[1]}}else if(f.length==3){if(typeof f[1]===r&&!(f[1].exec&&f[1].test)){t[f[0]]=c?f[1].call(this,c,f[2]):e}else{t[f[0]]=c?c.replace(f[1],f[2]):e}}else if(f.length==4){t[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):e}}else{t[f]=c?c:e}}break}}if(!!l)break}return t},str:function(t,r){for(var i in r){if(typeof r[i]===s&&r[i].length>0){for(var o=0;o<r[i].length;o++){if(m.has(r[i][o],t)){return i===n?e:i}}}else if(m.has(r[i],t)){return i===n?e:i}}return t}};var y={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}};var b={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],[a,c,o],[/\s(opr)\/((\d+)?[\w\.]+)/i],[[a,"Opera"],c,o],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],[a,c,o],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[[a,"IE"],c,o],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[a,"Yandex"],c,o],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[[a,/_/g," "],c,o],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[a,c,o],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[a,"Dolphin"],c,o],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[a,"Chrome"],c,o],[/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i],[[a,"Android Browser"],c,o],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[c,o,[a,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[c,o,a],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[a,[o,g.str,y.browser.oldsafari.major],[c,g.str,y.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],[a,c,o],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[a,"Netscape"],c,o],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[a,c,o]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,c],[/rv\:([\w\.]+).*(gecko)/i],[c,a]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[c,g.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[c,g.str,y.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],c],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[a,c],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],c],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],c],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,c],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],c],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],c],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,c],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[c,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[a,[c,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],[a,c]]};var w=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return g.rgx.apply(this,b.browser)};this.getEngine=function(){return g.rgx.apply(this,b.engine)};this.getOS=function(){return g.rgx.apply(this,b.os)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}};this.getUA=function(){return n};this.setUA=function(e){n=e;return this};this.setUA(n)};return(new w).getResult()}();var r=function(){var t={define_property:function(){return false}(),create_canvas:function(){var e=document.createElement("canvas");return!!(e.getContext&&e.getContext("2d"))}(),return_response_type:function(t){try{if(e.inArray(t,["","text","document"])!==-1){return true}else if(window.XMLHttpRequest){var n=new XMLHttpRequest;n.open("get","/");if("responseType"in n){n.responseType=t;if(n.responseType!==t){return false}return true}}}catch(r){}return false},use_data_uri:function(){var e=new Image;e.onload=function(){t.use_data_uri=e.width===1&&e.height===1};setTimeout(function(){e.src=""},1);return false}(),use_data_uri_over32kb:function(){return t.use_data_uri&&(i.browser!=="IE"||i.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&e<33e3||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");e.setAttribute("type","file");return!e.disabled}};return function(n){var r=[].slice.call(arguments);r.shift();return e.typeOf(t[n])==="function"?t[n].apply(this,r):!!t[n]}}();var i={can:r,browser:t.browser.name,version:parseFloat(t.browser.major),os:t.os.name,osVersion:t.os.version,verComp:n,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};i.OS=i.os;return i});i("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){if(typeof e!=="string"){return e}return document.getElementById(e)};var n=function(e,t){if(!e.className){return false}var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)};var r=function(e,t){if(!n(e,t)){e.className=!e.className?t:e.className.replace(/\s+$/,"")+" "+t}};var i=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return t===" "&&n===" "?" ":""})}};var s=function(e,t){if(e.currentStyle){return e.currentStyle[t]}else if(window.getComputedStyle){return window.getComputedStyle(e,null)[t]}};var o=function(t,n){function f(e){var t,n,r=0,i=0;if(e){n=e.getBoundingClientRect();t=o.compatMode==="CSS1Compat"?o.documentElement:o.body;r=n.left+t.scrollLeft;i=n.top+t.scrollTop}return{x:r,y:i}}var r=0,i=0,s,o=document,u,a;t=t;n=n||o.body;if(t&&t.getBoundingClientRect&&e.browser==="IE"&&(!o.documentMode||o.documentMode<8)){u=f(t);a=f(n);return{x:u.x-a.x,y:u.y-a.y}}s=t;while(s&&s!=n&&s.nodeType){r+=s.offsetLeft||0;i+=s.offsetTop||0;s=s.offsetParent}s=t.parentNode;while(s&&s!=n&&s.nodeType){r-=s.scrollLeft||0;i-=s.scrollTop||0;s=s.parentNode}return{x:r,y:i}};var u=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:r,removeClass:i,getStyle:s,getPos:o,getSize:u}});i("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var n;for(n in e){if(e[n]===t){return n}}return null}return{RuntimeError:function(){function r(e){this.code=e;this.name=t(n,e);this.message=this.name+": RuntimeError "+this.code}var n={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};e.extend(r,n);r.prototype=Error.prototype;return r}(),OperationNotAllowedException:function(){function t(e){this.code=e;this.name="OperationNotAllowedException"}e.extend(t,{NOT_ALLOWED_ERR:1});t.prototype=Error.prototype;return t}(),ImageError:function(){function r(e){this.code=e;this.name=t(n,e);this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};e.extend(r,n);r.prototype=Error.prototype;return r}(),FileException:function(){function r(e){this.code=e;this.name=t(n,e);this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};e.extend(r,n);r.prototype=Error.prototype;return r}(),DOMException:function(){function r(e){this.code=e;this.name=t(n,e);this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};e.extend(r,n);r.prototype=Error.prototype;return r}(),EventException:function(){function t(e){this.code=e;this.name="EventException"}e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0});t.prototype=Error.prototype;return t}()}});i("moxie/core/EventTarget",["moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){if(!this.uid){this.uid=t.guid("uid_")}},addEventListener:function(e,r,i,s){var o=this,u;e=t.trim(e);if(/\s/.test(e)){t.each(e.split(/\s+/),function(e){o.addEventListener(e,r,i,s)});return}e=e.toLowerCase();i=parseInt(i,10)||0;u=n[this.uid]&&n[this.uid][e]||[];u.push({fn:r,priority:i,scope:s||this});if(!n[this.uid]){n[this.uid]={}}n[this.uid][e]=u},hasEventListener:function(e){return e?!!(n[this.uid]&&n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,r){e=e.toLowerCase();var i=n[this.uid]&&n[this.uid][e],s;if(i){if(r){for(s=i.length-1;s>=0;s--){if(i[s].fn===r){i.splice(s,1);break}}}else{i=[]}if(!i.length){delete n[this.uid][e];if(t.isEmptyObj(n[this.uid])){delete n[this.uid]}}}},removeAllEventListeners:function(){if(n[this.uid]){delete n[this.uid]}},dispatchEvent:function(r){var i,s,o,u,a={},f=true,l;if(t.typeOf(r)!=="string"){u=r;if(t.typeOf(u.type)==="string"){r=u.type;if(u.total!==l&&u.loaded!==l){a.total=u.total;a.loaded=u.loaded}a.async=u.async||false}else{throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR)}}if(r.indexOf("::")!==-1){(function(e){i=e[0];r=e[1]})(r.split("::"))}else{i=this.uid}r=r.toLowerCase();s=n[i]&&n[i][r];if(s){s.sort(function(e,t){return t.priority-e.priority});o=[].slice.call(arguments);o.shift();a.type=r;o.unshift(a);var c=[];t.each(s,function(e){o[0].target=e.scope;if(a.async){c.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,o)===false)},1)})}else{c.push(function(t){t(e.fn.apply(e.scope,o)===false)})}});if(c.length){t.inSeries(c,function(e){f=!e})}}return f},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;if(t.typeOf(e)!=="array"){e=[e]}for(var r=0;r<e.length;r++){n="on"+e[r];if(t.typeOf(this[n])==="function"){this.addEventListener(e[r],this[n])}else if(t.typeOf(this[n])==="undefined"){this[n]=null}}}})}n.instance=new n;return n});i("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))};var t=function(e){return decodeURIComponent(escape(e))};var n=function(e,n){if(typeof window.atob==="function"){return n?t(window.atob(e)):window.atob(e)}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var i,s,o,u,a,f,l,c,h=0,p=0,d="",v=[];if(!e){return e}e+="";do{u=r.indexOf(e.charAt(h++));a=r.indexOf(e.charAt(h++));f=r.indexOf(e.charAt(h++));l=r.indexOf(e.charAt(h++));c=u<<18|a<<12|f<<6|l;i=c>>16&255;s=c>>8&255;o=c&255;if(f==64){v[p++]=String.fromCharCode(i)}else if(l==64){v[p++]=String.fromCharCode(i,s)}else{v[p++]=String.fromCharCode(i,s,o)}}while(h<e.length);d=v.join("");return n?t(d):d};var r=function(t,n){if(n){e(t)}if(typeof window.btoa==="function"){return window.btoa(t)}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var i,s,o,u,a,f,l,c,h=0,p=0,d="",v=[];if(!t){return t}do{i=t.charCodeAt(h++);s=t.charCodeAt(h++);o=t.charCodeAt(h++);c=i<<16|s<<8|o;u=c>>18&63;a=c>>12&63;f=c>>6&63;l=c&63;v[p++]=r.charAt(u)+r.charAt(a)+r.charAt(f)+r.charAt(l)}while(h<t.length);d=v.join("");var m=t.length%3;return(m?d.slice(0,m-3):d)+"===".slice(m||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:r}});i("moxie/runtime/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,n){function s(n,r,o,u,a){var f=this,l,c=e.guid(r+"_"),h=a||"browser";n=n||{};i[c]=this;o=e.extend({access_binary:false,access_image_binary:false,display_media:false,do_cors:false,drag_and_drop:false,filter_by_extension:true,resize_image:false,report_upload_progress:false,return_response_headers:false,return_response_type:false,return_status_code:true,send_custom_headers:false,select_file:false,select_folder:false,select_multiple:true,send_binary_string:false,send_browser_cookies:true,send_multipart:true,slice_blob:false,stream_upload:false,summon_file_dialog:false,upload_filesize:true,use_http_method:true},o);if(n.preferred_caps){h=s.getMode(u,n.preferred_caps,h)}l=function(){var t={};return{exec:function(e,n,r,i){if(l[n]){if(!t[e]){t[e]={context:this,instance:new l[n]}}if(t[e].instance[r]){return t[e].instance[r].apply(this,i)}}},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,r){if(e.typeOf(t.instance.destroy)==="function"){t.instance.destroy.call(t.context)}n.removeInstance(r)})}}}();e.extend(this,{initialized:false,uid:c,type:r,mode:s.getMode(u,n.required_caps,h),shimid:c+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||o;if(e.typeOf(t)==="string"&&e.typeOf(n)==="undefined"){t=s.parseCaps(t)}if(e.typeOf(t)==="object"){for(var i in t){if(!this.can(i,t[i],r)){return false}}return true}if(e.typeOf(r[t])==="function"){return r[t].call(this,n)}else{return n===r[t]}},getShimContainer:function(){var n,r=t.get(this.shimid);if(!r){n=this.options.container?t.get(this.options.container):document.body;r=document.createElement("div");r.id=this.shimid;r.className="moxie-shim moxie-shim-"+this.type;e.extend(r.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"});n.appendChild(r);n=null}return r},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return f.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);if(f[e]&&f[e][t]){return f[e][t].apply(this,n)}return f.shimExec.apply(this,arguments)},destroy:function(){if(!f){return}var e=t.get(this.shimid);if(e){e.parentNode.removeChild(e)}if(l){l.removeAllInstances()}this.unbindAll();delete i[this.uid];this.uid=null;c=f=l=e=null}});if(this.mode&&n.required_caps&&!this.can(n.required_caps)){this.mode=false}}var r={},i={};s.order="html5,flash,silverlight,html4";s.getRuntime=function(e){return i[e]?i[e]:false};s.addConstructor=function(e,t){t.prototype=n.instance;r[e]=t};s.getConstructor=function(e){return r[e]||null};s.getInfo=function(e){var t=s.getRuntime(e);if(t){return{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}}return null};s.parseCaps=function(t){var n={};if(e.typeOf(t)!=="string"){return t||{}}e.each(t.split(","),function(e){n[e]=true});return n};s.can=function(e,t){var n,r=s.getConstructor(e),i;if(r){n=new r({required_caps:t});i=n.mode;n.destroy();return!!i}return false};s.thatCan=function(e,t){var n=(t||s.order).split(/\s*,\s*/);for(var r in n){if(s.can(n[r],e)){return n[r]}}return null};s.getMode=function(t,n,r){var i=null;if(e.typeOf(r)==="undefined"){r="browser"}if(n&&!e.isEmptyObj(t)){e.each(n,function(n,r){if(t.hasOwnProperty(r)){var s=t[r](n);if(typeof s==="string"){s=[s]}if(!i){i=s}else if(!(i=e.arrayIntersect(i,s))){return i=false}}});if(i){return e.inArray(r,i)!==-1?r:i[0]}else if(i===false){return false}}return r};s.capTrue=function(){return true};s.capFalse=function(){return false};s.capTest=function(e){return function(){return!!e}};return s});i("moxie/runtime/RuntimeClient",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,n){return function(){var i;t.extend(this,{connectRuntime:function(r){function u(t){var o,a;if(!t.length){s.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR));i=null;return}o=t.shift();a=n.getConstructor(o);if(!a){u(t);return}i=new a(r);i.bind("Init",function(){i.initialized=true;setTimeout(function(){i.clients++;s.trigger("RuntimeInit",i)},1)});i.bind("Error",function(){i.destroy();u(t)});if(!i.mode){i.trigger("Error");return}i.init()}var s=this,o;if(t.typeOf(r)==="string"){o=r}else if(t.typeOf(r.ruid)==="string"){o=r.ruid}if(o){i=n.getRuntime(o);if(i){i.clients++;return i}else{throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}}u((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){if(i&&i.uid){return i}i=null;return null},disconnectRuntime:function(){if(i&&--i.clients<=0){i.destroy();i=null}}})}});i("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,n){function i(s,o){function u(t,n,s){var o,u=r[this.uid];if(e.typeOf(u)!=="string"||!u.length){return null}o=new i(null,{type:s,size:n-t});o.detach(u.substr(t,o.size));return o}n.call(this);if(s){this.connectRuntime(s)}if(!o){o={}}else if(e.typeOf(o)==="string"){o={data:o}}e.extend(this,{uid:o.uid||e.guid("uid_"),ruid:s,size:o.size||0,type:o.type||"",slice:function(e,t,n){if(this.isDetached()){return u.apply(this,arguments)}return this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){if(!r[this.uid]){return null}return r[this.uid]},detach:function(e){if(this.ruid){this.getRuntime().exec.call(this,"Blob","destroy");this.disconnectRuntime();this.ruid=null}e=e||"";var n=e.match(/^data:([^;]*);base64,/);if(n){this.type=n[1];e=t.atob(e.substring(e.indexOf("base64,")+7))}this.size=e.length;r[this.uid]=e},isDetached:function(){return!this.ruid&&e.typeOf(r[this.uid])==="string"},destroy:function(){this.detach();delete r[this.uid]}});if(o.data){this.detach(o.data)}else{r[this.uid]=o}}var r={};return i});i("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,n){function r(r,i){var s,o;if(!i){i={}}if(i.type&&i.type!==""){o=i.type}else{o=t.getFileMime(i.name)}if(i.name){s=i.name.replace(/\\/g,"/");s=s.substr(s.lastIndexOf("/")+1)}else{var u=o.split("/")[0];s=e.guid((u!==""?u:"file")+"_");if(t.extensions[o]){s+="."+t.extensions[o][0]}}n.apply(this,arguments);e.extend(this,{type:o||"",name:s||e.guid("file_"),lastModifiedDate:i.lastModifiedDate||(new Date).toLocaleString()})}r.prototype=n.prototype;return r});i("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/file/File","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,n,r,i,s,o,u,a){function l(i){var l=this,c,h,p;if(e.inArray(e.typeOf(i),["string","node"])!==-1){i={browse_button:i}}h=n.get(i.browse_button);if(!h){throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}p={accept:[{title:s.translate("All Files"),extensions:"*"}],name:"file",multiple:false,required_caps:false,container:h.parentNode||document.body};i=e.extend({},p,i);if(typeof i.required_caps==="string"){i.required_caps=u.parseCaps(i.required_caps)}if(typeof i.accept==="string"){i.accept=t.mimes2extList(i.accept)}c=n.get(i.container);if(!c){c=document.body}if(n.getStyle(c,"position")==="static"){c.style.position="relative"}c=h=null;a.call(l);e.extend(l,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){l.convertEventPropsToHandlers(f);l.bind("RuntimeInit",function(t,r){l.ruid=r.uid;l.shimid=r.shimid;l.bind("Ready",function(){l.trigger("Refresh")},999);l.bind("Change",function(){var t=r.exec.call(l,"FileInput","getFiles");l.files=[];e.each(t,function(e){if(e.size===0){return true}l.files.push(new o(l.ruid,e))})},999);l.bind("Refresh",function(){var t,s,o,u;o=n.get(i.browse_button);u=n.get(r.shimid);if(o){t=n.getPos(o,n.get(i.container));s=n.getSize(o);if(u){e.extend(u.style,{top:t.y+"px",left:t.x+"px",width:s.w+"px",height:s.h+"px"})}}u=o=null});r.exec.call(l,"FileInput","init",i)});l.connectRuntime(e.extend({},i,{required_caps:{select_file:true}}))},disable:function(t){var n=this.getRuntime();if(n){n.exec.call(this,"FileInput","disable",e.typeOf(t)==="undefined"?true:t)}},refresh:function(){l.trigger("Refresh")},destroy:function(){var t=this.getRuntime();if(t){t.exec.call(this,"FileInput","destroy");this.disconnectRuntime()}if(e.typeOf(this.files)==="array"){e.each(this.files,function(e){e.destroy()})}this.files=null}})}var f=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];l.prototype=i.instance;return l});i("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,n,r,i,s,o,u){function f(n){var o=this,f;if(typeof n==="string"){n={drop_zone:n}}f={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:true}};n=typeof n==="object"?r.extend({},f,n):f;n.container=t.get(n.drop_zone)||document.body;if(t.getStyle(n.container,"position")==="static"){n.container.style.position="relative"}if(typeof n.accept==="string"){n.accept=u.mimes2extList(n.accept)}s.call(o);r.extend(o,{uid:r.guid("uid_"),ruid:null,files:null,init:function(){o.convertEventPropsToHandlers(a);o.bind("RuntimeInit",function(e,t){o.ruid=t.uid;o.bind("Drop",function(){var e=t.exec.call(o,"FileDrop","getFiles");o.files=[];r.each(e,function(e){o.files.push(new i(o.ruid,e))})},999);t.exec.call(o,"FileDrop","init",n);o.dispatchEvent("ready")});o.connectRuntime(n)},destroy:function(){var e=this.getRuntime();if(e){e.exec.call(this,"FileDrop","destroy");this.disconnectRuntime()}this.files=null}})}var a=["ready","dragenter","dragleave","drop","error"];f.prototype=o.instance;return f});i("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,n){function r(){this.uid=e.guid("uid_");t.call(this);this.destroy=function(){this.disconnectRuntime();this.unbindAll()}}r.prototype=n.instance;return r});i("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/runtime/RuntimeTarget"],function(e,t,n,r,i,s,o){function a(){function f(e,f){function l(e){r.readyState=a.DONE;r.error=e;r.trigger("error");c()}function c(){s.destroy();s=null;r.trigger("loadend")}function h(t){s.bind("Error",function(e,t){l(t)});s.bind("Progress",function(e){r.result=t.exec.call(s,"FileReader","getResult");r.trigger(e)});s.bind("Load",function(e){r.readyState=a.DONE;r.result=t.exec.call(s,"FileReader","getResult");r.trigger(e);c()});t.exec.call(s,"FileReader","read",e,f)}s=new o;this.convertEventPropsToHandlers(u);if(this.readyState===a.LOADING){return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR))}this.readyState=a.LOADING;this.trigger("loadstart");if(f instanceof i){if(f.isDetached()){var p=f.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+f.type+";base64,"+t.btoa(p);break}this.readyState=a.DONE;this.trigger("load");c()}else{h(s.connectRuntime(f.ruid))}}else{l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}}var r=this,s;e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){f.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){f.call(this,"readAsDataURL",e)},readAsText:function(e){f.call(this,"readAsText",e)},abort:function(){this.result=null;if(e.inArray(this.readyState,[a.EMPTY,a.DONE])!==-1){return}else if(this.readyState===a.LOADING){this.readyState=a.DONE}if(s){s.getRuntime().exec.call(this,"FileReader","abort")}this.trigger("abort");this.trigger("loadend")},destroy:function(){this.abort();if(s){s.getRuntime().exec.call(this,"FileReader","destroy");s.disconnectRuntime()}r=s=null}})}var u=["loadstart","progress","load","abort","error","loadend"];a.EMPTY=0;a.LOADING=1;a.DONE=2;a.prototype=r.instance;return a});i("moxie/core/utils/Url",[],function(){var e=function(t,n){var r=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],i=r.length,s={http:80,https:443},o={},u=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,a=u.exec(t||"");while(i--){if(a[i]){o[r[i]]=a[i]}}if(!o.scheme){if(!n||typeof n==="string"){n=e(n||document.location.href)}o.scheme=n.scheme;o.host=n.host;o.port=n.port;var f="";if(/^[^\/]/.test(o.path)){f=n.path;if(!/(\/|\/[^\.]+)$/.test(f)){f=f.replace(/\/[^\/]+$/,"/")}else{f+="/"}}o.path=f+(o.path||"")}if(!o.port){o.port=s[o.scheme]||80}o.port=parseInt(o.port,10);if(!o.path){o.path="/"}delete o.source;return o};var t=function(t){var n={http:80,https:443},r=e(t);return r.scheme+"://"+r.host+(r.port!==n[r.scheme]?":"+r.port:"")+r.path+(r.query?r.query:"")};var n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}if(typeof t==="string"){t=e(t)}return n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}});i("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,n){return function(){function r(e,t){if(t.isDetached()){var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":var i="";for(var s=0,o=r.length;s<o;s++){i+=String.fromCharCode(r[s])}return i}}else{var u=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);this.disconnectRuntime();return u}}t.call(this);e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return r.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return r.call(this,"readAsDataURL",e)},readAsText:function(e){return r.call(this,"readAsText",e)}})}});i("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,n){function r(){var e,r=[];t.extend(this,{append:function(i,s){var o=this,u=t.typeOf(s);if(s instanceof n){e={name:i,value:s}}else if("array"===u){i+="[]";t.each(s,function(e){o.append(i,e)})}else if("object"===u){t.each(s,function(e,t){o.append(i+"["+t+"]",e)})}else if("null"===u||"undefined"===u||"number"===u&&isNaN(s)){o.append(i,"false")}else{r.push({name:i,value:s.toString()})}},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(r,function(e){n(e.value,e.name)});if(e){n(e.value,e.name)}},destroy:function(){e=null;r=[]}})}return r});i("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,n,r,i,s,o,u,a,f,l,c){function p(){this.uid=e.guid("uid_")}function g(){function I(e,t){if(!a.hasOwnProperty(e)){return}if(arguments.length===1){return l.can("define_property")?a[e]:n[e]}else{if(l.can("define_property")){a[e]=t}else{n[e]=t}}}function q(t){function r(){if(B){B.destroy();B=null}n.dispatchEvent("loadend");n=null}function i(i){B.bind("LoadStart",function(e){I("readyState",g.LOADING);n.dispatchEvent("readystatechange");n.dispatchEvent(e);if(k){n.upload.dispatchEvent(e)}});B.bind("Progress",function(e){if(I("readyState")!==g.LOADING){I("readyState",g.LOADING);n.dispatchEvent("readystatechange")}n.dispatchEvent(e)});B.bind("UploadProgress",function(e){if(k){n.upload.dispatchEvent({type:"progress",lengthComputable:false,total:e.total,loaded:e.loaded})}});B.bind("Load",function(t){I("readyState",g.DONE);I("status",Number(i.exec.call(B,"XMLHttpRequest","getStatus")||0));I("statusText",h[I("status")]||"");I("response",i.exec.call(B,"XMLHttpRequest","getResponse",I("responseType")));if(!!~e.inArray(I("responseType"),["text",""])){I("responseText",I("response"))}else if(I("responseType")==="document"){I("responseXML",I("response"))}j=i.exec.call(B,"XMLHttpRequest","getAllResponseHeaders");n.dispatchEvent("readystatechange");if(I("status")>0){if(k){n.upload.dispatchEvent(t)}n.dispatchEvent(t)}else{A=true;n.dispatchEvent("error")}r()});B.bind("Abort",function(e){n.dispatchEvent(e);r()});B.bind("Error",function(e){A=true;I("readyState",g.DONE);n.dispatchEvent("readystatechange");L=true;n.dispatchEvent(e);r()});i.exec.call(B,"XMLHttpRequest","send",{url:m,method:y,async:v,user:w,password:E,headers:b,mimeType:T,encoding:S,responseType:n.responseType,withCredentials:n.withCredentials,options:H},t)}var n=this;M=(new Date).getTime();B=new o;if(typeof H.required_caps==="string"){H.required_caps=s.parseCaps(H.required_caps)}H.required_caps=e.extend({},H.required_caps,{return_response_type:n.responseType});if(t instanceof f){H.required_caps.send_multipart=true}if(!O){H.required_caps.do_cors=true}if(H.ruid){i(B.connectRuntime(H))}else{B.bind("RuntimeInit",function(e,t){i(t)});B.bind("RuntimeError",function(e,t){n.dispatchEvent("RuntimeError",t)});B.connectRuntime(H)}}function R(){I("responseText","");I("responseXML",null);I("response",null);I("status",0);I("statusText","");M=_=null}var n=this,a={timeout:0,readyState:g.UNSENT,withCredentials:false,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},v=true,m,y,b={},w,E,S=null,T=null,N=false,C=false,k=false,L=false,A=false,O=false,M,_,D=null,P=null,H={},B,j="",F;e.extend(this,a,{uid:e.guid("uid_"),upload:new p,open:function(n,s,o,u,a){var f;if(!n||!s){throw new t.DOMException(t.DOMException.SYNTAX_ERR)}if(/[\u0100-\uffff]/.test(n)||r.utf8_encode(n)!==n){throw new t.DOMException(t.DOMException.SYNTAX_ERR)}if(!!~e.inArray(n.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])){y=n.toUpperCase()}if(!!~e.inArray(y,["CONNECT","TRACE","TRACK"])){throw new t.DOMException(t.DOMException.SECURITY_ERR)}s=r.utf8_encode(s);f=i.parseUrl(s);O=i.hasSameOrigin(f);m=i.resolveUrl(s);if((u||a)&&!O){throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR)}w=u||f.user;E=a||f.pass;v=o||true;if(v===false&&(I("timeout")||I("withCredentials")||I("responseType")!=="")){throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR)}N=!v;C=false;b={};R.call(this);I("readyState",g.OPENED);this.convertEventPropsToHandlers(["readystatechange"]);this.dispatchEvent("readystatechange")},setRequestHeader:function(n,i){var s=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(I("readyState")!==g.OPENED||C){throw new t.DOMException(t.DOMException.INVALID_STATE_ERR)}if(/[\u0100-\uffff]/.test(n)||r.utf8_encode(n)!==n){throw new t.DOMException(t.DOMException.SYNTAX_ERR)}n=e.trim(n).toLowerCase();if(!!~e.inArray(n,s)||/^(proxy\-|sec\-)/.test(n)){return false}if(!b[n]){b[n]=i}else{b[n]+=", "+i}return true},getAllResponseHeaders:function(){return j||""},getResponseHeader:function(t){t=t.toLowerCase();if(A||!!~e.inArray(t,["set-cookie","set-cookie2"])){return null}if(j&&j!==""){if(!F){F={};e.each(j.split(/\r\n/),function(t){var n=t.split(/:\s+/);if(n.length===2){n[0]=e.trim(n[0]);F[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])}}})}if(F.hasOwnProperty(t)){return F[t].header+": "+F[t].value}}return null},overrideMimeType:function(n){var r,i;if(!!~e.inArray(I("readyState"),[g.LOADING,g.DONE])){throw new t.DOMException(t.DOMException.INVALID_STATE_ERR)}n=e.trim(n.toLowerCase());if(/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))){n=r[1];if(r[2]){i=r[2]}}if(!c.mimes[n]){throw new t.DOMException(t.DOMException.SYNTAX_ERR)}D=n;P=i},send:function(n,i){if(e.typeOf(i)==="string"){H={ruid:i}}else if(!i){H={}}else{H=i}this.convertEventPropsToHandlers(d);this.upload.convertEventPropsToHandlers(d);if(this.readyState!==g.OPENED||C){throw new t.DOMException(t.DOMException.INVALID_STATE_ERR)}if(n instanceof u){H.ruid=n.ruid;T=n.type||"application/octet-stream"}else if(n instanceof f){if(n.hasBlob()){var s=n.getBlob();H.ruid=s.ruid;T=s.type||"application/octet-stream"}}else if(typeof n==="string"){S="UTF-8";T="text/plain;charset=UTF-8";n=r.utf8_encode(n)}if(!this.withCredentials){this.withCredentials=H.required_caps&&H.required_caps.send_browser_cookies&&!O}k=!N&&this.upload.hasEventListener();A=false;L=!n;if(!N){C=true}q.call(this,n)},abort:function(){A=true;N=false;if(!~e.inArray(I("readyState"),[g.UNSENT,g.OPENED,g.DONE])){I("readyState",g.DONE);C=false;if(B){B.getRuntime().exec.call(B,"XMLHttpRequest","abort",L)}else{throw new t.DOMException(t.DOMException.INVALID_STATE_ERR)}L=true}else{I("readyState",g.UNSENT)}},destroy:function(){if(B){if(e.typeOf(B.destroy)==="function"){B.destroy()}B=null}this.unbindAll();if(this.upload){this.upload.unbindAll();this.upload=null}}})}var h={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};p.prototype=n.instance;var d=["loadstart","progress","abort","error","load","timeout","loadend"];var v=1,m=2;g.UNSENT=0;g.OPENED=1;g.HEADERS_RECEIVED=2;g.LOADING=3;g.DONE=4;g.prototype=n.instance;return g});i("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,n,r){function i(){function l(){u=a=0;o=this.result=null}function c(t,n){var r=this;s=n;r.bind("TransportingProgress",function(t){a=t.loaded;if(a<u&&e.inArray(r.state,[i.IDLE,i.DONE])===-1){h.call(r)}},999);r.bind("TransportingComplete",function(){a=u;r.state=i.DONE;o=null;r.result=s.exec.call(r,"Transporter","getAsBlob",t||"")},999);r.state=i.BUSY;r.trigger("TransportingStarted");h.call(r)}function h(){var e=this,n,r=u-a;if(f>r){f=r}n=t.btoa(o.substr(a,f));s.exec.call(e,"Transporter","receive",n,u)}var r,s,o,u,a,f;n.call(this);e.extend(this,{uid:e.guid("uid_"),state:i.IDLE,result:null,transport:function(t,n,i){var s=this;i=e.extend({chunk_size:204798},i);if(r=i.chunk_size%3){i.chunk_size+=3-r}f=i.chunk_size;l.call(this);o=t;u=t.length;if(e.typeOf(i)==="string"||i.ruid){c.call(s,n,this.connectRuntime(i))}else{var a=function(e,t){s.unbind("RuntimeInit",a);c.call(s,n,t)};this.bind("RuntimeInit",a);this.connectRuntime(i)}},abort:function(){var e=this;e.state=i.IDLE;if(s){s.exec.call(e,"Transporter","clear");e.trigger("TransportingAborted")}l.call(e)},destroy:function(){this.unbindAll();s=null;this.disconnectRuntime();l.call(this)}})}i.IDLE=0;i.BUSY=1;i.DONE=2;i.prototype=r.instance;return i});i("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){function d(){function r(e){if(!e){e=this.getRuntime().exec.call(this,"Image","getInfo")}this.size=e.size;this.width=e.width;this.height=e.height;this.type=e.type;this.meta=e.meta;if(this.name===""){this.name=e.name}}function f(t){var r=e.typeOf(t);try{if(t instanceof d){if(!t.size){throw new n.DOMException(n.DOMException.INVALID_STATE_ERR)}v.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"])){throw new n.ImageError(n.ImageError.WRONG_FORMAT)}m.apply(this,arguments)}else if(e.inArray(r,["blob","file"])!==-1){f.call(this,new c(null,t),arguments[1])}else if(r==="string"){if(/^data:[^;]*;base64,/.test(t)){f.call(this,new l(null,{data:t}),arguments[1])}else{g.apply(this,arguments)}}else if(r==="node"&&t.nodeName.toLowerCase()==="img"){f.call(this,t.src,arguments[1])}else{throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR)}}catch(i){this.trigger("error",i.code)}}function v(t,n){var r=this.connectRuntime(t.ruid);this.ruid=r.uid;r.exec.call(this,"Image","loadFromImage",t,e.typeOf(n)==="undefined"?true:n)}function m(t,n){function i(e){r.ruid=e.uid;e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"";if(t.isDetached()){this.bind("RuntimeInit",function(e,t){i(t)});if(n&&typeof n.required_caps==="string"){n.required_caps=s.parseCaps(n.required_caps)}this.connectRuntime(e.extend({required_caps:{access_image_binary:true,resize_image:true}},n))}else{i(this.connectRuntime(t.ruid))}}function g(e,t){var n=this,r;r=new i;r.open("get",e);r.responseType="blob";r.onprogress=function(e){n.trigger(e)};r.onload=function(){m.call(n,r.response,true)};r.onerror=function(e){n.trigger(e)};r.onloadend=function(){r.destroy()};r.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)});r.send(null,t)}o.call(this);e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){r.call(this)},999);this.convertEventPropsToHandlers(p);f.apply(this,arguments)},downsize:function(t){var r={width:this.width,height:this.height,crop:false,preserveHeaders:true};if(typeof t==="object"){t=e.extend(r,t)}else{t=e.extend(r,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]})}try{if(!this.size){throw new n.DOMException(n.DOMException.INVALID_STATE_ERR)}if(this.width>d.MAX_RESIZE_WIDTH||this.height>d.MAX_RESIZE_HEIGHT){throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR)}this.getRuntime().exec.call(this,"Image","downsize",t.width,t.height,t.crop,t.preserveHeaders)}catch(i){this.trigger("error",i.code)}},crop:function(e,t,n){this.downsize(e,t,true,n)},getAsCanvas:function(){if(!a.can("create_canvas")){throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR)}var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size){throw new n.DOMException(n.DOMException.INVALID_STATE_ERR)}if(!e){e="image/jpeg"}if(e==="image/jpeg"&&!t){t=90}return this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size){throw new n.DOMException(n.DOMException.INVALID_STATE_ERR)}return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return h.atob(n.substring(n.indexOf("base64,")+7))},embed:function(r){function g(){if(a.can("create_canvas")){var t=s.getAsCanvas();if(t){r.appendChild(t);t=null;s.destroy();i.trigger("embedded");return}}var l=s.getAsDataURL(o,f);if(!l){throw new n.ImageError(n.ImageError.WRONG_FORMAT)}if(a.can("use_data_uri_of",l.length)){r.innerHTML='<img src="'+l+'" width="'+s.width+'" height="'+s.height+'" />';s.destroy();i.trigger("embedded")}else{var d=new u;d.bind("TransportingComplete",function(){m=i.connectRuntime(this.result.ruid);i.bind("Embedded",function(){e.extend(m.getShimContainer().style,{top:"0px",left:"0px",width:s.width+"px",height:s.height+"px"});m=null},999);m.exec.call(i,"ImageView","display",this.result.uid,p,v);s.destroy()});d.transport(h.atob(l.substring(l.indexOf("base64,")+7)),o,e.extend({},c,{required_caps:{display_media:true},runtime_order:"flash,silverlight",container:r}))}}var i=this,s,o,f,l,c=arguments[1]||{},p=this.width,v=this.height,m;try{if(!(r=t.get(r))){throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR)}if(!this.size){throw new n.DOMException(n.DOMException.INVALID_STATE_ERR)}if(this.width>d.MAX_RESIZE_WIDTH||this.height>d.MAX_RESIZE_HEIGHT){throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR)}o=c.type||this.type||"image/jpeg";f=c.quality||90;l=e.typeOf(c.crop)!=="undefined"?c.crop:false;if(c.width){p=c.width;v=c.height||p}else{var y=t.getSize(r);if(y.w&&y.h){p=y.w;v=y.h}}s=new d;s.bind("Resize",function(){g.call(i)});s.bind("Load",function(){s.downsize(p,v,l,false)});s.clone(this,false);return s}catch(b){this.trigger("error",b.code)}},destroy:function(){if(this.ruid){this.getRuntime().exec.call(this,"Image","destroy");this.disconnectRuntime()}this.unbindAll()}})}var p=["progress","load","error","resize","embedded"];d.MAX_RESIZE_WIDTH=6500;d.MAX_RESIZE_HEIGHT=6500;d.prototype=f.instance;return d});i("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,n,r){function o(t){var o=this,u=n.capTest,a=n.capTrue;var f=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u(r.can("create_canvas")||r.can("use_data_uri_over32kb")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&(r.browser!=="IE"||r.version>9)}()),filter_by_extension:u(function(){return r.browser==="Chrome"&&r.version>=28||r.browser==="IE"&&r.version>=10}()),return_response_headers:a,return_response_type:function(e){if(e==="json"&&!!window.JSON){return true}return r.can("return_response_type",e)},return_status_code:a,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&r.can("create_canvas")},select_file:function(){return r.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&r.browser==="Chrome"&&r.version>=21},select_multiple:function(){return o.can("select_file")&&!(r.browser==="Safari"&&r.os==="Windows")&&!(r.os==="iOS"&&r.verComp(r.osVersion,"7.0.4","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:u(function(){return r.browser==="Firefox"&&r.version>=4||r.browser==="Opera"&&r.version>=12||r.browser==="IE"&&r.version>=10||!!~e.inArray(r.browser,["Chrome","Safari"])}()),upload_filesize:a},arguments[2]);n.call(this,t,arguments[1]||i,f);e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o);e=o=null}}(this.destroy)});e.extend(this.getShim(),s)}var i="html5",s={};n.addConstructor(i,o);return s});i("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function n(){function e(e,t,n){var r;if(window.File.prototype.slice){try{e.slice();return e.slice(t,n)}catch(i){return e.slice(t,n-t)}}else if(r=window.File.prototype.webkitSlice||window.File.prototype.mozSlice){return r.call(e,t,n)}else{return null}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n});i("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function r(){this.returnValue=false}function i(){this.cancelBubble=true}var t={},n="moxie_"+e.guid();var s=function(s,o,u,a){var f,l;o=o.toLowerCase();if(s.addEventListener){f=u;s.addEventListener(o,f,false)}else if(s.attachEvent){f=function(){var e=window.event;if(!e.target){e.target=e.srcElement}e.preventDefault=r;e.stopPropagation=i;u(e)};s.attachEvent("on"+o,f)}if(!s[n]){s[n]=e.guid()}if(!t.hasOwnProperty(s[n])){t[s[n]]={}}l=t[s[n]];if(!l.hasOwnProperty(o)){l[o]=[]}l[o].push({func:f,orig:u,key:a})};var o=function(r,i,s){var o,u;i=i.toLowerCase();if(r[n]&&t[r[n]]&&t[r[n]][i]){o=t[r[n]][i]}else{return}for(var a=o.length-1;a>=0;a--){if(o[a].orig===s||o[a].key===s){if(r.removeEventListener){r.removeEventListener(i,o[a].func,false)}else if(r.detachEvent){r.detachEvent("on"+i,o[a].func)}o[a].orig=null;o[a].func=null;o.splice(a,1);if(s!==u){break}}}if(!o.length){delete t[r[n]][i]}if(e.isEmptyObj(t[r[n]])){delete t[r[n]];try{delete r[n]}catch(f){r[n]=u}}};var u=function(r,i){if(!r||!r[n]){return}e.each(t[r[n]],function(e,t){o(r,t,i)})};return{addEvent:s,removeEvent:o,removeAllEvents:u}});i("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,n,r,i,s){function o(){var e=[],o;t.extend(this,{init:function(u){var a=this,f=a.getRuntime(),l,c,h,p,d,v;o=u;e=[];h=o.accept.mimes||i.extList2mimes(o.accept,f.can("filter_by_extension"));c=f.getShimContainer();c.innerHTML='<input id="'+f.uid+'" type="file" style="font-size:999px;opacity:0;"'+(o.multiple&&f.can("select_multiple")?"multiple":"")+(o.directory&&f.can("select_folder")?"webkitdirectory directory":"")+(h?' accept="'+h.join(",")+'"':"")+" />";l=n.get(f.uid);t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"});p=n.get(o.browse_button);if(f.can("summon_file_dialog")){if(n.getStyle(p,"position")==="static"){p.style.position="relative"}d=parseInt(n.getStyle(p,"z-index"),10)||1;p.style.zIndex=d;c.style.zIndex=d-1;r.addEvent(p,"click",function(e){var t=n.get(f.uid);if(t&&!t.disabled){t.click()}e.preventDefault()},a.uid)}v=f.can("summon_file_dialog")?p:c;r.addEvent(v,"mouseover",function(){a.trigger("mouseenter")},a.uid);r.addEvent(v,"mouseout",function(){a.trigger("mouseleave")},a.uid);r.addEvent(v,"mousedown",function(){a.trigger("mousedown")},a.uid);r.addEvent(n.get(o.container),"mouseup",function(){a.trigger("mouseup")},a.uid);l.onchange=function m(){e=[];if(o.directory){t.each(this.files,function(t){if(t.name!=="."){e.push(t)}})}else{e=[].slice.call(this.files)}if(s.browser!=="IE"&&s.browser!=="IEMobile"){this.value=""}else{var n=this.cloneNode(true);this.parentNode.replaceChild(n,this);n.onchange=m}a.trigger("change")};a.trigger({type:"ready",async:true});c=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),r;if(r=n.get(t.uid)){r.disabled=!!e}},destroy:function(){var t=this.getRuntime(),i=t.getShim(),s=t.getShimContainer();r.removeAllEvents(s,this.uid);r.removeAllEvents(o&&n.get(o.container),this.uid);r.removeAllEvents(o&&n.get(o.browse_button),this.uid);if(s){s.innerHTML=""}i.removeInstance(this.uid);e=o=s=i=null}})}return e.FileInput=o});i("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,n,r,i){function s(){function u(e){if(!e.dataTransfer||!e.dataTransfer.types){return false}var n=t.toArray(e.dataTransfer.types||[]);return t.inArray("Files",n)!==-1||t.inArray("public.file-url",n)!==-1||t.inArray("application/x-moz-file",n)!==-1}function a(e){var n=[];for(var r=0;r<e.length;r++){[].push.apply(n,e[r].extensions.split(/\s*,\s*/))}return t.inArray("*",n)===-1?n:[]}function f(e){if(!s.length){return true}var n=i.getFileExtension(e.name);return!n||t.inArray(n,s)!==-1}function l(n,r){var i=[];t.each(n,function(t){var n=t.webkitGetAsEntry();if(n){if(n.isFile){var r=t.getAsFile();if(f(r)){e.push(r)}}else{i.push(n)}}});if(i.length){c(i,r)}else{r()}}function c(e,n){var r=[];t.each(e,function(e){r.push(function(t){h(e,t)})});t.inSeries(r,function(){n()})}function h(t,n){if(t.isFile){t.file(function(t){if(f(t)){e.push(t)}n()},function(){n()})}else if(t.isDirectory){p(t,n)}else{n()}}function p(e,t){function i(e){r.readEntries(function(t){if(t.length){[].push.apply(n,t);i(e)}else{e()}},e)}var n=[],r=e.createReader();i(function(){c(n,t)})}var e=[],s=[],o;t.extend(this,{init:function(n){var i=this,c;o=n;s=a(o.accept);c=o.container;r.addEvent(c,"dragover",function(e){if(!u(e)){return}e.preventDefault();e.dataTransfer.dropEffect="copy"},i.uid);r.addEvent(c,"drop",function(n){if(!u(n)){return}n.preventDefault();e=[];if(n.dataTransfer.items&&n.dataTransfer.items[0].webkitGetAsEntry){l(n.dataTransfer.items,function(){i.trigger("drop")})}else{t.each(n.dataTransfer.files,function(t){if(f(t)){e.push(t)}});i.trigger("drop")}},i.uid);r.addEvent(c,"dragenter",function(e){i.trigger("dragenter")},i.uid);r.addEvent(c,"dragleave",function(e){i.trigger("dragleave")},i.uid)},getFiles:function(){return e},destroy:function(){r.removeAllEvents(o&&n.get(o.container),this.uid);e=s=o=null}})}return e.FileDrop=s});i("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,n){function r(){function i(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var e,r=false;n.extend(this,{read:function(t,i){var s=this;e=new window.FileReader;e.addEventListener("progress",function(e){s.trigger(e)});e.addEventListener("load",function(e){s.trigger(e)});e.addEventListener("error",function(t){s.trigger(t,e.error)});e.addEventListener("loadend",function(){e=null});if(n.typeOf(e[t])==="function"){r=false;e[t](i.getSource())}else if(t==="readAsBinaryString"){r=true;e.readAsDataURL(i.getSource())}},getResult:function(){return e&&e.result?r?i(e.result):e.result:null},abort:function(){if(e){e.abort()}},destroy:function(){e=null}})}return e.FileReader=r});i("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,n,r,i,s,o,u,a){function f(){function c(t,n){var r=this,i,o;i=n.getBlob().getSource();o=new window.FileReader;o.onload=function(){n.append(n.getBlobName(),new s(null,{type:i.type,data:o.result}));e.send.call(r,t,n)};o.readAsBinaryString(i)}function h(){if(window.XMLHttpRequest&&!(a.browser==="IE"&&a.version<8)){return new window.XMLHttpRequest}else{return function(){var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"];for(var t=0;t<e.length;t++){try{return new ActiveXObject(e[t])}catch(n){}}}()}}function p(e){var t=e.responseXML;var n=e.responseText;if(a.browser==="IE"&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))){t=new window.ActiveXObject("Microsoft.XMLDOM");t.async=false;t.validateOnParse=false;t.loadXML(n)}if(t){if(a.browser==="IE"&&t.parseError!==0||!t.documentElement||t.documentElement.tagName==="parsererror"){return null}}return t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",r="\r\n",i="",o=this.getRuntime();if(!o.can("send_binary_string")){throw new u.RuntimeError(u.RuntimeError.NOT_SUPPORTED_ERR)}f.setRequestHeader("Content-Type","multipart/form-data; boundary="+t);e.each(function(e,o){if(e instanceof s){i+=n+t+r+'Content-Disposition: form-data; name="'+o+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+r+"Content-Type: "+(e.type||"application/octet-stream")+r+r+e.getSource()+r}else{i+=n+t+r+'Content-Disposition: form-data; name="'+o+'"'+r+r+unescape(encodeURIComponent(e))+r}});i+=n+t+n+r;return i}var e=this,f,l;t.extend(this,{send:function(e,n){var i=this,u=a.browser==="Mozilla"&&a.version>=4&&a.version<7,p=a.browser==="Android Browser",v=false;l=e.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase();f=h();f.open(e.method,e.url,e.async,e.user,e.password);if(n instanceof s){if(n.isDetached()){v=true}n=n.getSource()}else if(n instanceof o){if(n.hasBlob()){if(n.getBlob().isDetached()){n=d.call(i,n);v=true}else if((u||p)&&t.typeOf(n.getBlob().getSource())==="blob"&&window.FileReader){c.call(i,e,n);return}}if(n instanceof o){var m=new window.FormData;n.each(function(e,t){if(e instanceof s){m.append(t,e.getSource())}else{m.append(t,e)}});n=m}}if(f.upload){if(e.withCredentials){f.withCredentials=true}f.addEventListener("load",function(e){i.trigger(e)});f.addEventListener("error",function(e){i.trigger(e)});f.addEventListener("progress",function(e){i.trigger(e)});f.upload.addEventListener("progress",function(e){i.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})}else{f.onreadystatechange=function(){switch(f.readyState){case 1:break;case 2:break;case 3:var n,s;try{if(r.hasSameOrigin(e.url)){n=f.getResponseHeader("Content-Length")||0}if(f.responseText){s=f.responseText.length}}catch(o){n=s=0}i.trigger({type:"progress",lengthComputable:!!n,total:parseInt(n,10),loaded:s});break;case 4:f.onreadystatechange=function(){};if(f.status===0){i.trigger("error")}else{i.trigger("load")}break}}}if(!t.isEmptyObj(e.headers)){t.each(e.headers,function(e,t){f.setRequestHeader(t,e)})}if(""!==e.responseType&&"responseType"in f){if("json"===e.responseType&&!a.can("return_response_type","json")){f.responseType="text"}else{f.responseType=e.responseType}}if(!v){f.send(n)}else{if(f.sendAsBinary){f.sendAsBinary(n)}else{(function(){var e=new Uint8Array(n.length);for(var t=0;t<n.length;t++){e[t]=n.charCodeAt(t)&255}f.send(e.buffer)})()}}i.trigger("loadstart")},getStatus:function(){try{if(f){return f.status}}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var r=new i(t.uid,f.response);var s=f.getResponseHeader("Content-Disposition");if(s){var o=s.match(/filename=([\'\"'])([^\1]+)\1/);if(o){l=o[2]}}r.name=l;if(!r.type){r.type=n.getFileMime(l)}return r;case"json":if(!a.can("return_response_type","json")){return f.status===200&&!!window.JSON?JSON.parse(f.responseText):null}return f.response;case"document":return p(f);default:return f.responseText!==""?f.responseText:null}}catch(u){return null}},getAllResponseHeaders:function(){try{return f.getAllResponseHeaders()}catch(e){}return""},abort:function(){if(f){f.abort()}},destroy:function(){e=l=null}})}return e.XMLHttpRequest=f});i("moxie/runtime/html5/utils/BinaryReader",[],function(){return function(){function r(t,r){var i=e?0:-8*(r-1),s=0,o;for(o=0;o<r;o++){s|=n.charCodeAt(t+o)<<Math.abs(i+o*8)}return s}function i(e,t,r){r=arguments.length===3?r:n.length-t-1;n=n.substr(0,t)+e+n.substr(r+t)}function s(t,n,r){var s="",o=e?0:-8*(r-1),u;for(u=0;u<r;u++){s+=String.fromCharCode(n>>Math.abs(o+u*8)&255)}i(s,t,r)}var e=false,n;return{II:function(n){if(n===t){return e}else{e=n}},init:function(t){e=false;n=t},SEGMENT:function(e,t,r){switch(arguments.length){case 1:return n.substr(e,n.length-e-1);case 2:return n.substr(e,t);case 3:i(r,e,t);break;default:return n}},BYTE:function(e){return r(e,1)},SHORT:function(e){return r(e,2)},LONG:function(e,n){if(n===t){return r(e,4)}else{s(e,n,4)}},SLONG:function(e){var t=r(e,4);return t>2147483647?t-4294967296:t},STRING:function(e,t){var n="";for(t+=e;e<t;e++){n+=String.fromCharCode(r(e,1))}return n}}}});i("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader"],function(e){return function t(n){var r=[],i,s,o,u=0;i=new e;i.init(n);if(i.SHORT(0)!==65496){return}s=2;while(s<=n.length){o=i.SHORT(s);if(o>=65488&&o<=65495){s+=2;continue}if(o===65498||o===65497){break}u=i.SHORT(s+2)+2;if(o>=65505&&o<=65519){r.push({hex:o,name:"APP"+(o&15),start:s,length:u,segment:i.SEGMENT(s,u)})}s+=u}i.init(null);return{headers:r,restore:function(e){var t,n;i.init(e);s=i.SHORT(2)==65504?4+i.SHORT(4):2;for(n=0,t=r.length;n<t;n++){if(r[n].name=="APP2"&&r[n].segment.indexOf("ProPhoto RGB")>0){continue}else{i.SEGMENT(s,0,r[n].segment);s+=r[n].length}}e=i.SEGMENT();i.init(null);return e},strip:function(e){var n,r,s;r=new t(e);n=r.headers;r.purge();i.init(e);s=n.length;while(s--){i.SEGMENT(n[s].start,n[s].length,"")}e=i.SEGMENT();i.init(null);return e},get:function(e){var t=[];for(var n=0,i=r.length;n<i;n++){if(r[n].name===e.toUpperCase()){t.push(r[n].segment)}}return t},set:function(e,t){var n=[],i,s,o;if(typeof t==="string"){n.push(t)}else{n=t}for(i=s=0,o=r.length;i<o;i++){if(r[i].name===e.toUpperCase()){r[i].segment=n[s];r[i].length=n[s].length;s++}if(s>=n.length){break}}},purge:function(){r=[];i.init(null);i=null}}}});i("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,n){return function(){function f(e,n){var r=i.SHORT(e),s,o,f,l,c,h,p,d,v=[],m={};for(s=0;s<r;s++){p=h=e+12*s+2;f=n[i.SHORT(p)];if(f===t){continue}l=i.SHORT(p+=2);c=i.LONG(p+=2);p+=4;v=[];switch(l){case 1:case 7:if(c>4){p=i.LONG(p)+u.tiffHeader}for(o=0;o<c;o++){v[o]=i.BYTE(p+o)}break;case 2:if(c>4){p=i.LONG(p)+u.tiffHeader}m[f]=i.STRING(p,c-1);continue;case 3:if(c>2){p=i.LONG(p)+u.tiffHeader}for(o=0;o<c;o++){v[o]=i.SHORT(p+o*2)}break;case 4:if(c>1){p=i.LONG(p)+u.tiffHeader}for(o=0;o<c;o++){v[o]=i.LONG(p+o*4)}break;case 5:p=i.LONG(p)+u.tiffHeader;for(o=0;o<c;o++){v[o]=i.LONG(p+o*4)/i.LONG(p+o*4+4)}break;case 9:p=i.LONG(p)+u.tiffHeader;for(o=0;o<c;o++){v[o]=i.SLONG(p+o*4)}break;case 10:p=i.LONG(p)+u.tiffHeader;for(o=0;o<c;o++){v[o]=i.SLONG(p+o*4)/i.SLONG(p+o*4+4)}break;default:continue}d=c==1?v[0]:v;if(a.hasOwnProperty(f)&&typeof d!="object"){m[f]=a[f][d]}else{m[f]=d}}return m}function l(){var e=u.tiffHeader;i.II(i.SHORT(e)==18761);if(i.SHORT(e+=2)!==42){return false}u.IFD0=u.tiffHeader+i.LONG(e+=2);o=f(u.IFD0,s.tiff);if("ExifIFDPointer"in o){u.exifIFD=u.tiffHeader+o.ExifIFDPointer;delete o.ExifIFDPointer}if("GPSInfoIFDPointer"in o){u.gpsIFD=u.tiffHeader+o.GPSInfoIFDPointer;delete o.GPSInfoIFDPointer}return true}function c(e,t,n){var r,o,a,f=0;if(typeof t==="string"){var l=s[e.toLowerCase()];for(var c in l){if(l[c]===t){t=c;break}}}r=u[e.toLowerCase()+"IFD"];o=i.SHORT(r);for(var h=0;h<o;h++){a=r+12*h+2;if(i.SHORT(a)==t){f=a+8;break}}if(!f){return false}i.LONG(f,n);return true}var i,s,o,u={},a;i=new n;s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}};a={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}};return{init:function(e){u={tiffHeader:10};if(e===t||!e.length){return false}i.init(e);if(i.SHORT(0)===65505&&i.STRING(4,5).toUpperCase()==="EXIF\0"){return l()}return false},TIFF:function(){return o},EXIF:function(){var t;t=f(u.exifIFD,s.exif);if(t.ExifVersion&&e.typeOf(t.ExifVersion)==="array"){for(var n=0,r="";n<t.ExifVersion.length;n++){r+=String.fromCharCode(t.ExifVersion[n])}t.ExifVersion=r}return t},GPS:function(){var t;t=f(u.gpsIFD,s.gps);if(t.GPSVersionID&&e.typeOf(t.GPSVersionID)==="array"){t.GPSVersionID=t.GPSVersionID.join(".")}return t},setExif:function(e,t){if(e!=="PixelXDimension"&&e!=="PixelYDimension"){return false}return c("exif",e,t)},getBinary:function(){return i.SEGMENT()},purge:function(){i.init(null);i=o=null;u={}}}}});i("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,n,r,i){function s(s){function h(){var e=0,t,n;while(e<=o.length){t=u.SHORT(e+=2);if(t>=65472&&t<=65475){e+=5;return{height:u.SHORT(e),width:u.SHORT(e+=2)}}n=u.SHORT(e+=2);e+=n-2}return null}function p(){if(!f||!a||!u){return}f.purge();a.purge();u.init(null);o=l=a=f=u=null}var o,u,a,f,l,c;o=s;u=new r;u.init(o);if(u.SHORT(0)!==65496){throw new t.ImageError(t.ImageError.WRONG_FORMAT)}a=new n(s);f=new i;c=!!f.init(a.get("app1")[0]);l=h.call(this);e.extend(this,{type:"image/jpeg",size:o.length,width:l&&l.width||0,height:l&&l.height||0,setExif:function(t,n){if(!c){return false}if(e.typeOf(t)==="object"){e.each(t,function(e,t){f.setExif(t,e)})}else{f.setExif(t,n)}a.set("app1",f.getBinary())},writeHeaders:function(){if(!arguments.length){return o=a.restore(o)}return a.restore(arguments[0])},stripHeaders:function(e){return a.strip(e)},purge:function(){p.call(this)}});if(c){this.meta={tiff:f.TIFF(),exif:f.EXIF(),gps:f.GPS()}}}return s});i("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,n){function r(r){function f(){var e,t;e=c.call(this,8);if(e.type=="IHDR"){t=e.start;return{width:s.LONG(t),height:s.LONG(t+=4)}}return null}function l(){if(!s){return}s.init(null);i=a=o=u=s=null}function c(e){var t,n,r,i;t=s.LONG(e);n=s.STRING(e+=4,4);r=e+=4;i=s.LONG(e+t);return{length:t,type:n,start:r,CRC:i}}var i,s,o,u,a;i=r;s=new n;s.init(i);(function(){var t=0,n=0,r=[35152,20039,3338,6666];for(n=0;n<r.length;n++,t+=2){if(r[n]!=s.SHORT(t)){throw new e.ImageError(e.ImageError.WRONG_FORMAT)}}})();a=f.call(this);t.extend(this,{type:"image/png",size:i.length,width:a.width,height:a.height,purge:function(){l.call(this)}});l.call(this)}return r});i("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,n,r){return function(i){var s=[n,r],o;o=function(){for(var e=0;e<s.length;e++){try{return new s[e](i)}catch(n){}}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}();e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}});e.extend(this,o);this.purge=function(){o.purge();o=null}}});i("moxie/runtime/html5/image/MegaPixel",[],function(){function e(e,r,i){var s=e.naturalWidth,o=e.naturalHeight;var u=i.width,a=i.height;var f=i.x||0,l=i.y||0;var c=r.getContext("2d");if(t(e)){s/=2;o/=2}var h=1024;var p=document.createElement("canvas");p.width=p.height=h;var d=p.getContext("2d");var v=n(e,s,o);var m=0;while(m<o){var g=m+h>o?o-m:h;var y=0;while(y<s){var b=y+h>s?s-y:h;d.clearRect(0,0,h,h);d.drawImage(e,-y,-m);var w=y*u/s+f<<0;var E=Math.ceil(b*u/s);var S=m*a/o/v+l<<0;var x=Math.ceil(g*a/o/v);c.drawImage(p,0,0,b,g,w,S,E,x);y+=h}m+=h}p=d=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1024*1024){var r=document.createElement("canvas");r.width=r.height=1;var i=r.getContext("2d");i.drawImage(e,-t+1,0);return i.getImageData(0,0,1,1).data[3]===0}else{return false}}function n(e,t,n){var r=document.createElement("canvas");r.width=1;r.height=n;var i=r.getContext("2d");i.drawImage(e,0,0);var s=i.getImageData(0,0,1,n).data;var o=0;var u=n;var a=n;while(a>o){var f=s[(a-1)*4+3];if(f===0){u=a}else{o=a}a=u+o>>1}r=null;var l=a/n;return l===0?1:l}return{isSubsampled:t,renderTo:e}});i("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/MegaPixel","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,n,r,i,s,o,u,a){function f(){function m(){if(!c&&!f){throw new n.ImageError(n.DOMException.INVALID_STATE_ERR)}return c||f}function g(e){return r.atob(e.substring(e.indexOf("base64,")+7))}function y(e,t){return"data:"+(t||"")+";base64,"+r.btoa(e)}function b(e){var t=this;f=new Image;f.onerror=function(){N.call(this);t.trigger("error",n.ImageError.WRONG_FORMAT)};f.onload=function(){t.trigger("load")};f.src=/^data:[^;]*;base64,/.test(e)?e:y(e,p.type)}function w(e,t){var r=this,i;if(window.FileReader){i=new FileReader;i.onload=function(){t(this.result)};i.onerror=function(){r.trigger("error",n.ImageError.WRONG_FORMAT)};i.readAsDataURL(e)}else{return t(e.getAsDataURL())}}function E(e,n,r,i){var s=this,o,u,a=0,f=0,l,h,p,g;v=i;g=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;if(t.inArray(g,[5,6,7,8])!==-1){var y=e;e=n;n=y}l=m();if(!r){o=Math.min(e/l.width,n/l.height)}else{e=Math.min(e,l.width);n=Math.min(n,l.height);o=Math.max(e/l.width,n/l.height)}if(o>1&&!r&&i){this.trigger("Resize");return}if(!c){c=document.createElement("canvas")}h=Math.round(l.width*o);p=Math.round(l.height*o);if(r){c.width=e;c.height=n;if(h>e){a=Math.round((h-e)/2)}if(p>n){f=Math.round((p-n)/2)}}else{c.width=h;c.height=p}if(!v){T(c.width,c.height,g)}S.call(this,l,c,-a,-f,h,p);this.width=c.width;this.height=c.height;d=true;s.trigger("Resize")}function S(e,t,n,r,i,s){if(a.OS==="iOS"){o.renderTo(e,t,{width:i,height:s,x:n,y:r})}else{var u=t.getContext("2d");u.drawImage(e,n,r,i,s)}}function T(e,t,n){switch(n){case 5:case 6:case 7:case 8:c.width=t;c.height=e;break;default:c.width=e;c.height=t}var r=c.getContext("2d");switch(n){case 2:r.translate(e,0);r.scale(-1,1);break;case 3:r.translate(e,t);r.rotate(Math.PI);break;case 4:r.translate(0,t);r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI);r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI);r.translate(0,-t);break;case 7:r.rotate(.5*Math.PI);r.translate(e,-t);r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI);r.translate(-e,0);break}}function N(){if(l){l.purge();l=null}h=f=c=p=null;d=false}var e=this,f,l,c,h,p,d=false,v=true;t.extend(this,{loadFromBlob:function(e){var t=this,r=t.getRuntime(),i=arguments.length>1?arguments[1]:true;if(!r.can("access_binary")){throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR)}p=e;if(e.isDetached()){h=e.getSource();b.call(this,h);return}else{w.call(this,e.getSource(),function(e){if(i){h=g(e)}b.call(t,e)})}},loadFromImage:function(e,t){this.meta=e.meta;p=new i(null,{name:e.name,size:e.size,type:e.type});b.call(this,t?h=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var e=this.getRuntime(),t;if(!l&&h&&e.can("access_image_binary")){l=new s(h)}t={width:m().width||0,height:m().height||0,type:p.type||u.getFileMime(p.name),size:h&&h.length||p.size||0,name:p.name||"",meta:l&&l.meta||this.meta||{}};return t},downsize:function(){E.apply(this,arguments)},getAsCanvas:function(){if(c){c.id=this.uid+"_canvas"}return c},getAsBlob:function(t,n){if(t!==this.type){E.call(this,this.width,this.height,false)}return new i(null,{name:p.name||"",type:t,data:e.getAsBinaryString.call(this,t,n)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!d){return f.src}if("image/jpeg"!==e){return c.toDataURL("image/png")}else{try{return c.toDataURL("image/jpeg",t/100)}catch(n){return c.toDataURL("image/jpeg")}}},getAsBinaryString:function(t,n){if(!d){if(!h){h=g(e.getAsDataURL(t,n))}return h}if("image/jpeg"!==t){h=g(e.getAsDataURL(t,n))}else{var r;if(!n){n=90}try{r=c.toDataURL("image/jpeg",n/100)}catch(i){r=c.toDataURL("image/jpeg")}h=g(r);if(l){h=l.stripHeaders(h);if(v){if(l.meta&&l.meta.exif){l.setExif({PixelXDimension:this.width,PixelYDimension:this.height})}h=l.writeHeaders(h)}l.purge();l=null}}d=false;return h},destroy:function(){e=null;N.call(this);this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=f});i("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,n,r,i){function u(){var e;try{e=navigator.plugins["Shockwave Flash"];e=e.description}catch(t){try{e=(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}catch(n){e="0.0"}}e=e.match(/\d+/g);return parseFloat(e[0]+"."+e[1])}function a(a){var f=this,l;a=e.extend({swf_url:t.swf_url},a);i.call(this,a,s,{access_binary:function(e){return e&&f.mode==="browser"},access_image_binary:function(e){return e&&f.mode==="browser"},display_media:i.capTrue,do_cors:i.capTrue,drag_and_drop:false,report_upload_progress:function(){return f.mode==="client"},resize_image:i.capTrue,return_response_headers:false,return_response_type:function(t){if(t==="json"&&!!window.JSON){return true}return!e.arrayDiff(t,["","text","document"])||f.mode==="browser"},return_status_code:function(t){return f.mode==="browser"||!e.arrayDiff(t,[200,404])},select_file:i.capTrue,select_multiple:i.capTrue,send_binary_string:function(e){return e&&f.mode==="browser"},send_browser_cookies:function(e){return e&&f.mode==="browser"},send_custom_headers:function(e){return e&&f.mode==="browser"},send_multipart:i.capTrue,slice_blob:function(e){return e&&f.mode==="browser"},stream_upload:function(e){return e&&f.mode==="browser"},summon_file_dialog:false,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||f.mode==="client"},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client");if(u()<10){this.mode=false}e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return f.getShim().exec(this.uid,e,t,n)},init:function(){var n,i,s;s=this.getShimContainer();e.extend(s.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"});n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ';if(t.browser==="IE"){n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '}n+='width="100%" height="100%" style="outline:0">'+'<param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>";if(t.browser==="IE"){i=document.createElement("div");s.appendChild(i);i.outerHTML=n;i=s=null}else{s.innerHTML=n}l=setTimeout(function(){if(f&&!f.initialized){f.trigger("Error",new r.RuntimeError(r.RuntimeError.NOT_INIT_ERR))}},5e3)},destroy:function(e){return function(){e.call(f);clearTimeout(l);a=l=e=f=null}}(this.destroy)},o)}var s="flash",o={};i.addConstructor(s,a);return o});i("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var n={slice:function(e,n,r,i){var s=this.getRuntime();if(n<0){n=Math.max(e.size+n,0)}else if(n>0){n=Math.min(n,e.size)}if(r<0){r=Math.max(e.size+r,0)}else if(r>0){r=Math.min(r,e.size)}e=s.shimExec.call(this,"Blob","slice",n,r,i||"");if(e){e=new t(s.uid,e)}return e}};return e.Blob=n});i("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime"],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple});this.trigger("ready")}};return e.FileInput=t});i("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function r(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n="";var i={read:function(e,t){var i=this,s=i.getRuntime();if(e==="readAsDataURL"){n="data:"+(t.type||"")+";base64,"}i.bind("Progress",function(t,i){if(i){n+=r(i,e)}});return s.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return n},destroy:function(){n=null}};return e.FileReader=i});i("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var r={read:function(e,t){var r,i=this.getRuntime();r=i.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid);if(!r){return null}if(e==="readAsDataURL"){r="data:"+(t.type||"")+";base64,"+r}return n(r,e,t.type)}};return e.FileReaderSync=r});i("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter"],function(e,t,n,r,i,s,o){var u={send:function(e,r){function a(){e.transport=u.mode;u.shimExec.call(i,"XMLHttpRequest","send",e,r)}function f(e,t){u.shimExec.call(i,"XMLHttpRequest","appendBlob",e,t.uid);r=null;a()}function l(e,t){var n=new o;n.bind("TransportingComplete",function(){t(this.result)});n.transport(e.getSource(),e.type,{ruid:u.uid})}var i=this,u=i.getRuntime();if(!t.isEmptyObj(e.headers)){t.each(e.headers,function(e,t){u.shimExec.call(i,"XMLHttpRequest","setRequestHeader",t,e.toString())})}if(r instanceof s){var c;r.each(function(e,t){if(e instanceof n){c=t}else{u.shimExec.call(i,"XMLHttpRequest","append",t,e)}});if(!r.hasBlob()){r=null;a()}else{var h=r.getBlob();if(h.isDetached()){l(h,function(e){h.destroy();f(c,e)})}else{f(c,h)}}}else if(r instanceof n){if(r.isDetached()){l(r,function(e){r.destroy();r=e.uid;a()})}else{r=r.uid;a()}}else{a()}},getResponse:function(e){var n,s,o=this.getRuntime();s=o.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob");if(s){s=new r(o.uid,s);if("blob"===e){return s}try{n=new i;if(!!~t.inArray(e,["","text"])){return n.readAsText(s)}else if("json"===e&&!!window.JSON){return JSON.parse(n.readAsText(s))}}finally{s.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort");this.dispatchEvent("readystatechange");this.dispatchEvent("abort")}};return e.XMLHttpRequest=u});i("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),r=n.shimExec.call(this,"Transporter","getAsBlob",e);if(r){return new t(n.uid,r)}return null}};return e.Transporter=n});i("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,n,r,i){var s={loadFromBlob:function(e){function i(e){r.shimExec.call(t,"Image","loadFromBlob",e.uid);t=r=null}var t=this,r=t.getRuntime();if(e.isDetached()){var s=new n;s.bind("TransportingComplete",function(){i(s.result.getSource())});s.transport(e.getSource(),e.type,{ruid:r.uid})}else{i(e.getSource())}},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),i=n.shimExec.call(this,"Image","getAsBlob",e,t);if(i){return new r(n.uid,i)}return null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;if(!t){return null}n=new i;return n.readAsDataURL(t)}};return e.Image=s});i("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,n,r,i){function u(e){var t=false,n=null,r,i,s,o,u,a=0;try{try{n=new ActiveXObject("AgControl.AgControl");if(n.IsVersionSupported(e)){t=true}n=null}catch(f){var l=navigator.plugins["Silverlight Plug-In"];if(l){r=l.description;if(r==="1.0.30226.2"){r="2.0.30226.2"}i=r.split(".");while(i.length>3){i.pop()}while(i.length<4){i.push(0)}s=e.split(".");while(s.length>4){s.pop()}do{o=parseInt(s[a],10);u=parseInt(i[a],10);a++}while(a<s.length&&o===u);if(o<=u&&!isNaN(o)){t=true}}}}catch(c){t=false}return t}function a(a){var f=this,l;a=e.extend({xap_url:t.xap_url},a);i.call(this,a,s,{access_binary:i.capTrue,access_image_binary:i.capTrue,display_media:i.capTrue,do_cors:i.capTrue,drag_and_drop:false,report_upload_progress:i.capTrue,resize_image:i.capTrue,return_response_headers:function(e){return e&&f.mode==="client"},return_response_type:function(e){if(e!=="json"){return true}else{return!!window.JSON}},return_status_code:function(t){return f.mode==="client"||!e.arrayDiff(t,[200,404])},select_file:i.capTrue,select_multiple:i.capTrue,send_binary_string:i.capTrue,send_browser_cookies:function(e){return e&&f.mode==="browser"},send_custom_headers:function(e){return e&&f.mode==="client"},send_multipart:i.capTrue,slice_blob:i.capTrue,stream_upload:true,summon_file_dialog:false,upload_filesize:i.capTrue,use_http_method:function(t){return f.mode==="client"||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}});if(!u("2.0.31005.0")||t.browser==="Opera"){this.mode=false}e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return f.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer();e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>";l=setTimeout(function(){if(f&&!f.initialized){f.trigger("Error",new r.RuntimeError(r.RuntimeError.NOT_INIT_ERR))}},t.OS!=="Windows"?1e4:5e3)},destroy:function(e){return function(){e.call(f);clearTimeout(l);a=l=e=f=null}}(this.destroy)},o)}var s="silverlight",o={};i.addConstructor(s,a);return o});i("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,n){return e.Blob=t.extend({},n)});i("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime"],function(e){var t={init:function(e){function t(e){var t="";for(var n=0;n<e.length;n++){t+=(t!==""?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.")}return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple);this.trigger("ready")}};return e.FileInput=t});i("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,n){var r={init:function(){var e=this,r=e.getRuntime(),i;i=r.getShimContainer();n.addEvent(i,"dragover",function(e){e.preventDefault();e.stopPropagation();e.dataTransfer.dropEffect="copy"},e.uid);n.addEvent(i,"dragenter",function(e){e.preventDefault();var n=t.get(r.uid).dragEnter(e);if(n){e.stopPropagation()}},e.uid);n.addEvent(i,"drop",function(e){e.preventDefault();var n=t.get(r.uid).dragDrop(e);if(n){e.stopPropagation()}},e.uid);return r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=r});i("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,n){return e.FileReader=t.extend({},n)});i("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,n){return e.FileReaderSync=t.extend({},n)});i("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest"],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)});i("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,n){return e.Transporter=t.extend({},n)});i("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/image/Image"],function(e,t,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps"],r={meta:{}},i=e.shimExec.call(this,"Image","getInfo");if(i.meta){t.each(n,function(e){var t=i.meta[e],n,s,o,u;if(t&&t.keys){r.meta[e]={};for(s=0,o=t.keys.length;s<o;s++){n=t.keys[s];u=t[n];if(u){if(/^(\d|[1-9]\d+)$/.test(u)){u=parseInt(u,10)}else if(/^\d*\.\d+$/.test(u)){u=parseFloat(u)}r.meta[e][n]=u}}}})}r.width=parseInt(i.width,10);r.height=parseInt(i.height,10);r.size=parseInt(i.size,10);r.type=i.type;r.name=i.name;return r}})});i("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,n,r){function o(t){var o=this,u=n.capTest,a=n.capTrue;n.call(this,t,i,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:false,display_media:u(s.Image&&(r.can("create_canvas")||r.can("use_data_uri_over32kb"))),do_cors:false,drag_and_drop:false,filter_by_extension:u(function(){return r.browser==="Chrome"&&r.version>=28||r.browser==="IE"&&r.version>=10}()),resize_image:function(){return s.Image&&o.can("access_binary")&&r.can("create_canvas")},report_upload_progress:false,return_response_headers:false,return_response_type:function(t){if(t==="json"&&!!window.JSON){return true}return!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return r.can("use_fileinput")},select_multiple:false,send_binary_string:false,send_custom_headers:false,send_multipart:true,slice_blob:false,stream_upload:function(){return o.can("select_file")},summon_file_dialog:u(function(){return r.browser==="Firefox"&&r.version>=4||r.browser==="Opera"&&r.version>=12||!!~e.inArray(r.browser,["Chrome","Safari"])}()),upload_filesize:a,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}});e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o);e=o=null}}(this.destroy)});e.extend(this.getShim(),s)}var i="html4",s={};n.addConstructor(i,o);return s});i("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,n,r,i,s){function o(){function f(){var i=this,l=i.getRuntime(),c,h,p,d,v,m;m=t.guid("uid_");c=l.getShimContainer();if(e){p=n.get(e+"_form");if(p){t.extend(p.style,{top:"100%"})}}d=document.createElement("form");d.setAttribute("id",m+"_form");d.setAttribute("method","post");d.setAttribute("enctype","multipart/form-data");d.setAttribute("encoding","multipart/form-data");t.extend(d.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"});v=document.createElement("input");v.setAttribute("id",m);v.setAttribute("type","file");v.setAttribute("name",a.name||"Filedata");v.setAttribute("accept",u.join(","));t.extend(v.style,{fontSize:"999px",opacity:0});d.appendChild(v);c.appendChild(d);t.extend(v.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"});if(s.browser==="IE"&&s.version<10){t.extend(v.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"})}v.onchange=function(){var e;if(!this.value){return}if(this.files){e=this.files[0]}else{e={name:this.value}}o=[e];this.onchange=function(){};f.call(i);i.bind("change",function t(){var e=n.get(m),r=n.get(m+"_form"),s;i.unbind("change",t);if(i.files.length&&e&&r){s=i.files[0];e.setAttribute("id",s.uid);r.setAttribute("id",s.uid+"_form");r.setAttribute("target",s.uid+"_iframe")}e=r=null},998);v=d=null;i.trigger("change")};if(l.can("summon_file_dialog")){h=n.get(a.browse_button);r.removeEvent(h,"click",i.uid);r.addEvent(h,"click",function(e){if(v&&!v.disabled){v.click()}e.preventDefault()},i.uid)}e=m;c=p=h=null}var e,o=[],u=[],a;t.extend(this,{init:function(e){var t=this,s=t.getRuntime(),o;a=e;u=e.accept.mimes||i.extList2mimes(e.accept,s.can("filter_by_extension"));o=s.getShimContainer();(function(){var i,u,a;i=n.get(e.browse_button);if(s.can("summon_file_dialog")){if(n.getStyle(i,"position")==="static"){i.style.position="relative"}u=parseInt(n.getStyle(i,"z-index"),10)||1;i.style.zIndex=u;o.style.zIndex=u-1}a=s.can("summon_file_dialog")?i:o;r.addEvent(a,"mouseover",function(){t.trigger("mouseenter")},t.uid);r.addEvent(a,"mouseout",function(){t.trigger("mouseleave")},t.uid);r.addEvent(a,"mousedown",function(){t.trigger("mousedown")},t.uid);r.addEvent(n.get(e.container),"mouseup",function(){t.trigger("mouseup")},t.uid);i=null})();f.call(this);o=null;t.trigger({type:"ready",async:true})},getFiles:function(){return o},disable:function(t){var r;if(r=n.get(e)){r.disabled=!!t}},destroy:function(){var t=this.getRuntime(),i=t.getShim(),s=t.getShimContainer();r.removeAllEvents(s,this.uid);r.removeAllEvents(a&&n.get(a.container),this.uid);r.removeAllEvents(a&&n.get(a.browse_button),this.uid);if(s){s.innerHTML=""}i.removeInstance(this.uid);e=o=u=a=s=i=null}})}return e.FileInput=o});i("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t});i("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,n,r,i,s,o,u){function a(){function l(e){var t=this,r,i,o,u,a=false;if(!f){return}r=f.id.replace(/_iframe$/,"");i=n.get(r+"_form");if(i){o=i.getElementsByTagName("input");u=o.length;while(u--){switch(o[u].getAttribute("type")){case"hidden":o[u].parentNode.removeChild(o[u]);break;case"file":a=true;break}}o=[];if(!a){i.parentNode.removeChild(i)}i=null}setTimeout(function(){s.removeEvent(f,"load",t.uid);if(f.parentNode){f.parentNode.removeChild(f)}var n=t.getRuntime().getShimContainer();if(!n.children.length){n.parentNode.removeChild(n)}n=f=null;e()},1)}var e,a,f;t.extend(this,{send:function(c,h){function b(){var n=d.getShimContainer()||document.body,i=document.createElement("div");i.innerHTML='<iframe id="'+v+'_iframe" name="'+v+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>';f=i.firstChild;n.appendChild(f);s.addEvent(f,"load",function(){var n;try{n=f.contentWindow.document||f.contentDocument||window.frames[f.id].document;if(/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)){e=n.title.replace(/^(\d+).*$/,"$1")}else{e=200;a=t.trim(n.body.innerHTML);p.trigger({type:"progress",loaded:a.length,total:a.length});if(y){p.trigger({type:"uploadprogress",loaded:y.size||1025,total:y.size||1025})}}}catch(i){if(r.hasSameOrigin(c.url)){e=404}else{l.call(p,function(){p.trigger("error")});return}}l.call(p,function(){p.trigger("load")})},p.uid)}var p=this,d=p.getRuntime(),v,m,g,y;e=a=null;if(h instanceof u&&h.hasBlob()){y=h.getBlob();v=y.uid;g=n.get(v);m=n.get(v+"_form");if(!m){throw new i.DOMException(i.DOMException.NOT_FOUND_ERR)}}else{v=t.guid("uid_");m=document.createElement("form");m.setAttribute("id",v+"_form");m.setAttribute("method",c.method);m.setAttribute("enctype","multipart/form-data");m.setAttribute("encoding","multipart/form-data");m.setAttribute("target",v+"_iframe");d.getShimContainer().appendChild(m)}if(h instanceof u){h.each(function(e,n){if(e instanceof o){if(g){g.setAttribute("name",n)}}else{var r=document.createElement("input");t.extend(r,{type:"hidden",name:n,value:e});if(g){m.insertBefore(r,g)}else{m.appendChild(r)}}})}m.setAttribute("action",c.url);b();m.submit();p.trigger("loadstart")},getStatus:function(){return e},getResponse:function(e){if("json"===e){if(t.typeOf(a)==="string"&&!!window.JSON){try{return JSON.parse(a.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}}}else if("document"===e){}return a},abort:function(){var e=this;if(f&&f.contentWindow){if(f.contentWindow.stop){f.contentWindow.stop()}else if(f.contentWindow.document.execCommand){f.contentWindow.document.execCommand("Stop")}else{f.src="about:blank"}}l.call(this,function(){e.dispatchEvent("abort")})}})}return e.XMLHttpRequest=a});i("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t});u(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/file/FileDrop","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"])})(this);(function(e){"use strict";var t={},n=e.moxie.core.utils.Basic.inArray;(function r(e){var i,s;for(i in e){s=typeof e[i];if(s==="object"&&!~n(i,["Exceptions","Env","Mime"])){r(e[i])}else if(s==="function"){t[i]=e[i]}}})(e.moxie);t.Env=e.moxie.core.utils.Env;t.Mime=e.moxie.core.utils.Mime;t.Exceptions=e.moxie.core.Exceptions;e.mOxie=t;if(!e.o){e.o=t}return t})(this)
/**
 * Plupload - multi-runtime File Uploader
 * v2.1.1
 *
 * Copyright 2013, Moxiecode Systems AB
 * Released under GPL License.
 *
 * License: http://www.plupload.com/license
 * Contributing: http://www.plupload.com/contributing
 *
 * Date: 2014-01-16
 */
;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),e.resize.enabled&&(n.send_binary_string=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.1.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<f.length;n++)!e&&f[n].status==o.QUEUED?(e=f[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==f.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",f))}}function y(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e<f.length;e++)t=f[e],t.size!==n?(d.size+=t.origSize,d.loaded+=t.loaded*t.origSize/t.size):d.size=n,t.status==o.DONE?d.uploaded++:t.status==o.FAILED?d.failed++:d.queued++;d.size===n?d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded",C),this.bind("CancelUpload",M),this.bind("BeforeUpload",k),this.bind("UploadFile",L),this.bind("UploadProgress",A),this.bind("StateChanged",O),this.bind("QueueChanged",b),this.bind("Error",D),this.bind("FileUploaded",_),this.bind("Destroy",P)}function x(e,n){var r=this,i=0,s=[],u={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t;break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){[].push.apply(f,t),e.trigger("QueueChanged"),e.refresh()}function k(e,t){if(a.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function L(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g,y;if(n.status==o.DONE||n.status==o.FAILED||e.state==o.STOPPED)return;g={name:n.target_name||n.name},s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y<c.size?(d.destroy(),f+=y,n.loaded=Math.min(f,c.size),e.trigger("ChunkUploaded",n,{offset:n.loaded,total:c.size,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&e.trigger("UploadProgress",n)):n.loaded=n.size,d=v=null,!f||f>=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(g.name=n.target_name||n.name,m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s*Math.floor(n.loaded/s)),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function A(e,t){y(t)}function O(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function M(){m&&m.abort()}function _(e){b(),r(function(){g.call(e)},1)}function D(e,t){t.file&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function P(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)});if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}S.call(this),x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function l(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function c(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!f)return!1;e.ruid=f,e.connectRuntime(f)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){l(e,function(n){n||(a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?c(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):i==="array"&&(n=null,t.each(e,c))}var s=this,u=[],a=[],f;f=w(),c(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(i=!0,this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),this.trigger("QueueChanged"),this.refresh(),i&&this.start(),r},bind:function(e,t,n){var r=this;o.Uploader.prototype.bind.call(this,e,function(){var e=[].slice.call(arguments);return e.splice(0,1,r),t.apply(this,e)},0,n)},destroy:function(){this.trigger("Destroy"),a=d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
/* Smooth.js */
function Smoothing() {
    var m = this;
    m.hasSmoothing = function() {
        if (typeof screen.fontSmoothingEnabled != "undefined") return screen.fontSmoothingEnabled;
        else try {
            var f = document.createElement("canvas");
            f.width = "35";
            f.height = "35";
            f.style.display = "none";
            document.body.appendChild(f);
            var o = f.getContext("2d");
            o.textBaseline = "top";
            o.font = "32px Arial";
            o.fillStyle = "black";
            o.strokeStyle = "black";
            o.fillText("E", 0, 0);
            for (var r = 8; r <= 32; r++) for (var u = 1; u <= 32; u++) {
                var q = o.getImageData(u, r, 1, 1).data[3];
                if (q != 255 && q != 0) {
                    document.body.removeChild(f);
                    return true
                }
            }
            document.body.removeChild(f);
            return false
        } catch(y) {
            return null
        }
    };
    m.insertClasses = function() {
        var f = !(navigator.userAgent.indexOf("Windows NT 5.1") > -1) ? true: m.hasSmoothing();
        document.getElementsByTagName("html")[0].className += f == true ? " hasFontSmoothing-true": f == false ? " hasFontSmoothing-false": " hasFontSmoothing-unknown"
    }
    m.insertClasses();
};
$(function(){
    Smoothing();
});
/* mfw.js */


/**
 * @method 被iframe调用的回调函数
 * @return
 * @author
 * @update 08.09.18 13:20:54
 */
function cbUploadImg(flag,code)
{
    if(flag == 'fail')
        alert(code);
    else
    {
        jQuery("#imgshow").attr('src',code);
        processImg.init ("draw");
        //$('#leftslider').show();
        //$('#rightslider').show();
    }
}


/**
 * @OBJ :  chip用户上传头像
 * @ps
 * @return
 * @author
 * @update 08.11.17 18:59:48
 */
var processImg = {
    _imgsetWH : [120,120],
    _showimgWH : [120,120],
    _showimgTL:[0,0],
    _min : 0,
    _max : 100,
    _start : 50
};

processImg.init = function(flag){

    jQuery("#imgshow").draggable({
        snapMode:'outer',
        cursor: 'move',
        //containment: $('#imgwrapp'),
        drag: function(e, ui) {
            processImg._showimgTL[0] = ui.position.top;
            processImg._showimgTL[1] = ui.position.left;
        },
        stop: function(e,ui){
            //debug(processImg._showimgTL);
        }
    });

    if(flag == "draw")
        jQuery("#imgshow").load(this.getimgwh); //注册事件 图片加载完成时取图片的原始大小
    else
        this.getimgwh();
    this.slider();
}

// 改函数给showimg的load事件调用，所以这里的this 是showimg
processImg.getimgwh = function(){
    var src = jQuery("#imgshow").attr("src");
    var timg = jQuery('<img>').attr('src', src).css({ position: 'absolute', top: '-1000px', left: '-1000px' }).appendTo('body');
    var size = [ timg.get(0).offsetWidth, timg.get(0).offsetHeight ];
    try { document.body.removeChild(timg[0]); }
    catch(e) {};
    processImg._showimgWH = size; // 得到加载图片的原始大小
    var left = (size[0] - processImg._imgsetWH[0]) / 2;
    var top = (size[1] - processImg._imgsetWH[1]) / 2;
    jQuery("#imgshow").css("left",-left+"px");
    jQuery("#imgshow").css("top",-top+"px");
};

processImg.slider = function(){

    jQuery("#imgshow").removeAttr("width");
    jQuery("#imgshow").removeAttr("height");
    jQuery("#slider3").slider("destroy");
    jQuery("#slider3").slider({
        min:processImg._min,
        max:processImg._max,
        startValue:processImg._start,
        stop:function(e,ui){},
        slide:function(e,ui){

            var P = processImg;
            var oldw = jQuery("#imgshow").attr("width");
            var oldh = jQuery("#imgshow").attr("height");

            var w,h,t,l;
            var v = ui.value;
            var rate = v / P._start;

            if(rate*P._showimgWH[0] <= P._imgsetWH[0] || rate*P._showimgWH[1] <= P._imgsetWH[1])
            {
                return;
            }
            w = rate*P._showimgWH[0];
            h = rate*P._showimgWH[1];
            var wadd = (w - oldw)/2;
            var hadd = (h - oldh)/2;

            l = jQuery("#imgshow").css("left");
            if(l== 'auto') l = "0px";
            l = l.split("px")[0];
            //if(isNaN(l)) l = 0;
            l = l - wadd;
            jQuery("#imgshow").css("left",l+"px");

            t = jQuery("#imgshow").css("top");
            if(t== 'auto') t = "0px";
            t = t.split("px")[0];
            //if(isNaN(t)) t = 0;
            t = t - hadd;
            jQuery("#imgshow").css("top",t+"px");

            jQuery("#imgshow").attr("width",w);
            jQuery("#imgshow").attr("height",h);

        }
    });
}

processImg.imgchip = function(){
    var para = {};
    var img = jQuery("#imgshow");
    para['wsrc'] = img.attr("width");
    para['hsrc'] = img.attr("height");
    para['w'] = img.attr("width");
    para['h'] = img.attr("height");
    para['l'] = img.css("left").split("px")[0];
    para['t'] = img.css("top").split("px")[0];
    para['img'] = img.attr("src");

    jQuery(":input[name='img']").val(para['img']);
    jQuery(":input[name='wsrc']").val(para['wsrc']);
    jQuery(":input[name='hsrc']").val(para['hsrc']);
    jQuery(":input[name='w']").val(para['w']);
    jQuery(":input[name='h']").val(para['h']);
    jQuery(":input[name='l']").val(para['l']);
    jQuery(":input[name='t']").val(para['t']);

    jQuery("#chipform").submit();
    //var url = "/group/chipimgajax.php";
    //$.post(url,para,function(data){ processImg.cbImgChip(data);});
}



processImg.cbImgChip = function(data){
    jQuery("#bglogo").val(proJson_2(data));
}


function closeDiv(id)
{
    $("#"+id)[0].style.display  = "none";
}


// msn invite
function G_MsnInvite(msn, passwd)
{
    $("#invitemsg")[0].style.display = "";
    var url = "/home/msninvite_ajax.php";
    var pars = "msn=" + msn + "&passwd=" + passwd;
    var myAjax = new Ajax.Request(url, {method: "post", parameters: pars, onComplete: function (req) { CB_MsnInvite(req); } });
}

function CB_MsnInvite(req)
{
    var  re = proJson(req);
    if(re == 1)
    {
        window.location.href="/home/msninvite_form.php";
    }
    else
    {
        $("#invitemsg")[0].style.display = "none";
    }
}

function checkInviteMsn()
{
    var msn = $("#msn")[0].value;
    var passwd = $("#passwd")[0].value;

    if(msn == "" || passwd == "")
    {
        alert("msn账号和密码不能为空");
        return;
    }

    G_MsnInvite(msn, passwd);
}

/**
 * @method 复制到剪贴板
 * @return
 * @author sina & zhoudan@staff.sina.com.cn
 * @update 08.11.14 16:06:04
 */
function copyToClipboard(txt) {
    if(window.clipboardData)
    {
        window.clipboardData.clearData();
        window.clipboardData.setData("Text", txt);
    }
    else if(navigator.userAgent.indexOf("Opera") != -1)
    {
        window.location = txt;
    }
    else if (window.netscape)
    {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        }
        catch (e)
        {
            alert("!!被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip)
            return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans)
            return;
        trans.addDataFlavor('text/unicode');
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = txt;
        str.data = copytext;
        trans.setTransferData("text/unicode",str,copytext.length*2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip)
            return false;
        clip.setData(trans,null,clipid.kGlobalClipboard);
    }
    return true;
}

function go(url)
{
    window.location.href = url;
}
/* common.js */

function G_GetAnchor()
{
    var str = window.location.href.split("#");
    if (str.length >= 2)
    {
        return str[1];
    }
    return "0";
}

var g_auserhighlight = new Array();

function G_UserHighLight()
{
    for(i=0; i<g_auserhighlight.length; i++)
    {
        clearInterval(g_auserhighlight[i]);
    }
    g_auserhighlight = new Array();
    if (typeof(userhighlight) == "object")
    {
        if (typeof($(userhighlight).length) == "undefined")
        {
            g_auserhighlight.push(setInterval("$(userhighlight).style.color=($(userhighlight).style.color!='#eda000')?'#eda000':'#eb4e01';",500));
        }
        else
        {
            for(i=0; i<$(userhighlight).length; i++)
            {
                g_auserhighlight.push(setInterval("$(userhighlight)[" + i + "].style.color=($(userhighlight)[" + i + "].style.color!='#eda000')?'#eda000':'#eb4e01';",500));
            }
        }
    }
}

function G_ShowResponse(req, v_div)
{
    $(v_div).html( req.res );
    G_UserHighLight();
}

function G_ShowJsonResponse(req, v_div)
{
    $(v_div).html( proJson(req) );
    G_UserHighLight();
}

function G_ShowJsonResponse_2(req, v_div)
{
    $(v_div).html( proJson_2(req) );
    G_UserHighLight();
}

var infovote = new Array();
function G_ShowVote(v_iid, v_vote, v_div)
{

    if(typeof(infovote[v_iid]) == "undefined")
    {
        var url = "/group/infovote.php";
        var pars = "iid=" + v_iid + "&vote=" + v_vote;
        infovote[v_iid] = 1;
        //var myAjax = new Ajax.Request(url, {method: "post", parameters: pars, onComplete: function (req) { G_ShowJsonResponse(req, v_div); } });
        jQuery.post(url,{iid : v_iid, vote : v_vote},function(req){G_ShowJsonResponse(req, v_div);}, 'json');
    }
}


function G_ShowGUInfo_2(page, v_div)
{
    var url = "/group/infolist_gu.php";
    var para = {};
    para['page'] = page;
    jQuery.post(url,para,function(req){G_ShowJsonResponse_2(req, v_div);}, 'json');
}

function G_ShowGUInfo_ta(uid,page, v_div)
{
    var url = "/group/infolist_gu.php";
    var para = {};
    para['page'] = page;
    para['type'] = 'ta';
    para['uid'] = uid;
    jQuery.post(url,para,function(req){G_ShowJsonResponse_2(req, v_div);}, 'json');
}

function G_Play()
{
    mfwplayer.controls.play();
}

function G_Pause()
{
    mfwplayer.controls.pause();
}

function G_Stop()
{
    mfwplayer.controls.stop();
}

function G_Invite()
{

    if($("form[name='invite'] :checkbox:checked").size() == 0)
    {
        alert("请至少选择一个邀请人。");
        return false;
    }
    var idarr =   jQuery.map($("form[name='invite'] :checkbox:checked").not("#checkbox"), function(check){
        return $(check).attr('id');
    });
    var idstr = "";
    jQuery.each( idarr, function(i, n){
        if(n != "")
        {
            idstr += n+",";
        }
    });
    idstr = idstr.substr(0,(idstr.length) -1);
    $(":input[name='ids']").attr('value',idstr);
    $("form[name='invite']").submit();
}

/**
 *  处理json输出
 * @method
 * @return
 * @author iask & zhoudan@staff.sina.com.cn
 * @update 08.11.18 01:20:11
 * @exception
 *
 */
function proJson(req)
{
    if('err' == req.flag){
        //TODO
        alert( req.flag);
    } else {
        return req.res;
    }
}

function proJson_2(req)
{
    if('err' == req.flag){
        //TODO
        alert( req.flag);
    } else {
        return req.res;
    }
}

/* plugins.js */

(function(){

    var SlideDown = function( option ){
        this.option = option;
    }

    SlideDown.prototype.display = function(){

        var winWidth = $(window).width(), self = this, timer;

        $('body').prepend(
            '<div id="ywf_topimg" style="display:none; width:'+winWidth+'px; margin:0 auto; text-align:center; overflow: hidden; background:#5FCFE7; ">' +
                '<a target="_blank" href="/sales/" style="display:block; width:100%; height:100%;" >' +
                '<img src="http://images.mafengwo.net/images/mdd/yiwofeng/topimg_20130829.jpg" />' +
                '</a>' +
                '</div>');

        setTimeout(function(){
            $('#ywf_topimg').slideDown(1000);

            setTimeout(function(){
                $('#ywf_topimg').animate(
                    {height: 100},
                    {complete: function(){
                        $('#ywf_topimg').bind('mouseenter', function(){
                            timer = setTimeout(function(){
                                $('#ywf_topimg').animate({height:208}, {duration:500});
                            }, 500);
                        });
                        $('#ywf_topimg').bind('mouseleave', function(){
                            clearTimeout(timer);
                            $('#ywf_topimg').animate({height:100},{duration:500});
                        });
                    }}
                );
            }, 8 * 1000);
        }, 1500);

        $('#ywf_topimg').bind('click',function(){
            $.get('/ajax/ajax_op_log_api.php?type=yiwofeng&mk='+encodeURIComponent('V4_目的地天窗跳转'));
        });
    }

    $(function(){
        return false;
        if(location.href.indexOf('sales') > 0) return false;

//        if($('.ub-info>a').attr('href') != '/u/17172230.html') return;

        $.getJSON('/sales/ajax.php', { act: 'GetInterest' }, function(json){
            if(json.ret == 1){
                (new SlideDown({ sales_id: json.msg })).display();
                $.get('/ajax/ajax_op_log_api.php?type=yiwofeng&mk='+encodeURIComponent('V5_天窗_弹出总数'));

            }
        });
    });

})();

(function ($) {
    $.asset = {
        Err:"服务器繁忙！"
    };
    function bindmodel() {
        $().keypress(modelstate).keyup(modelstate).mousedown(modelstate);
    }

    function unbindmodel() {
        $().unbind("keypress", modelstate).unbind("keyup", modelstate).unbind("mousedown", modelstate);
    }

    function modelstate(e) {
        var _r = !$(e.target).parents('#popup_container')[0];
        if (_r) {
            setTimeout(function () {
                try {
                    $("#popup_container input").eq(0).focus();
                } catch (_) {
                }
                ;
            }, 10);
        }
    }

    ;
    $.alerts = {

        // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time

        verticalOffset:-75, // vertical offset of the dialog from center screen, in pixels
        horizontalOffset:0, // horizontal offset of the dialog from center screen, in pixels/
        repositionOnResize:true, // re-centers the dialog on window resize
        overlayOpacity:.6, // transparency level of overlay
        overlayColor:'#000000', // base color of overlay
        draggable:false, // make the dialogs draggable (requires UI Draggables plugin)
        okButton:'&nbsp;\u786e\u5b9a&nbsp;', // text for the OK button
        cancelButton:'&nbsp;\u53d6\u6d88&nbsp;', // text for the Cancel button
        dialogClass:null, // if specified, this class will be applied to all dialogs
        modal:true,

        // Public methods

        alert:function (message, title, callback, icon, hide_close) {
            if (title == null || typeof(title) == 'undefined') {
                title = message;
                message = '';
            }
            if(icon == null || typeof(icon) == 'undefined') {
                icon = 1;
            }
            return $.alerts._show(title, message, null, 'alert', icon, function (result) {
                if (callback) {
                    var _ret = callback(result);
                    if (_ret === true || typeof(_ret) == "undefined") {
                        $.alerts._hide();
                    }
                    else {
                        $.alerts._errtip(_ret);
                    }
                }
                else {
                    $.alerts._hide();
                }
            }, hide_close);
        },

        confirm:function (message, callback, title, icon, hide_close) {
            if (title == null || typeof(title) == 'undefined') {
                title = message;
                message = '';
            }
            if(icon == null || typeof(icon) == 'undefined') {
                icon = 2;
            }
            return  $.alerts._show(title, message, null, 'confirm', icon, function (result) {
                if (callback) {
                    var _ret = callback(result);
                    if (_ret === true || typeof(_ret) == "undefined") {
                        $.alerts._hide();
                    }
                    else {
                        $.alerts._errtip(_ret);
                    }
                }
                else {
                    $.alerts._hide();
                }
            }, hide_close);
        },

        prompt:function (message, callback, value, title, hide_close) {
            if (title == null || typeof(title) == 'undefined') title = '请您输入';
            return $.alerts._show(title, message, value, 'prompt', -1, function (result) {
                if (callback) {
                    var _ret = callback(result);
                    if (_ret === true || typeof(_ret) == "undefined") {
                        $.alerts._hide();
                    }
                    else {
                        $.alerts._errtip(_ret);
                    }
                }
                else {
                    $.alerts._hide();
                }
            }, hide_close);
        },

        // Private methods

        _show:function (title, msg, value, type, icon, callback, hide_close) {

            $.alerts._hide();
            $.alerts._overlay('show');

            $("BODY").append(
                '<div id="popup_container" class="popup-box new-popbox">'
                    + '<a class="close-btn" href="javascript:void(0);" id="popup_close"><i></i></a>'
                    + '<div class="pop-ico" id="popup_icon"></div>'
                    + '<div class="pop-ctn"><p class="hd" id="popup_title"></p><p class="bd" id="popup_message"></p></div>'
                    + '<div class="pop-btns" id="popup_btn"></div>'
                    + '</div>');

            if ($.alerts.dialogClass) $("#popup_container").addClass($.alerts.dialogClass);

            if(icon == -1) {
                $("#popup_icon").remove();
            } else {
                icon = parseInt(icon) > 3 ? 3 : parseInt(icon);
                $("#popup_icon").html('<i class="i' + icon + '"></i>')
            }

            $("#popup_content").addClass(type);
            $("#popup_title").html(title.replace(/\n/g, ''));
            $("#popup_message").html(msg.replace(/\n/g, ''));

            if(hide_close) {
                $("#popup_close").hide();
            } else {
                $("#popup_close").click(function () {
                    $.alerts._hide();
                });
            }

            switch (type) {
                case 'alert':
                    $("#popup_btn").html('<a role="button" tabindex="0" class="popbtn popbtn-submit" id="popup_ok">' + $.alerts.okButton + '</a>');
                    $("#popup_ok").click(function () {
                        setTimeout(function () {
                            callback(true);
                        }, 10);
                    });
                    $("#popup_ok").focus().keypress(function (e) {
                        if (e.keyCode == 13 || e.keyCode == 27) $("#popup_ok").trigger('click');
                    });
                    if ($.alerts.modal)bindmodel();
                    break;
                case 'confirm':
                    $("#popup_btn").html('<a role="button" tabindex="0" class="popbtn popbtn-cancel popbtn-half" id="popup_cancel">' + $.alerts.cancelButton + '</a><a role="button" tabindex="0" class="popbtn popbtn-submit popbtn-half" id="popup_ok">' + $.alerts.okButton + '</a>');
                    $("#popup_ok").click(function() {
                        setTimeout(function () {
                            callback(true);
                        }, 10);
                    });
                    $("#popup_cancel").click(function () {
                        setTimeout(function () {
                            callback(false);
                        }, 10);
                    });
                    $("#popup_ok").focus();
                    $("#popup_ok").keypress(function (e) {
                        if (e.keyCode == 13) $("#popup_ok").trigger('click');
                    });
                    $("#popup_cancel").keypress(function (e) {
                        if (e.keyCode == 13)  $("#popup_cancel").trigger('click');
                    });
                    if($.alerts.modal) bindmodel();
                    break;
                case 'prompt':
                    $("#popup_title").closest('.pop-ctn').removeClass('pop-ctn').addClass('pop-con');
                    $("#popup_message").html('<input type="text" class="oneline" id="popup_prompt" />');
                    $("#popup_btn").html('<a role="button" tabindex="0" class="popbtn popbtn-cancel popbtn-half" id="popup_cancel">' + $.alerts.cancelButton + '</a><a role="button" tabindex="0" class="popbtn popbtn-submit popbtn-half" id="popup_ok">' + $.alerts.okButton + '</a>');
                    $("#popup_ok").click(function () {
                        var val = $("#popup_prompt").val();
                        setTimeout(function () {
                            callback(val);
                        }, 10);
                    });
                    $("#popup_cancel").click(function () {
                        $.alerts._hide();
                        setTimeout(function () {
                            if (callback) callback(null);
                        }, 10);
                    });
                    $("#popup_prompt, #popup_ok").keypress(function (e) {
                        if (e.keyCode == 13) $("#popup_ok").trigger('click');
                        if (e.keyCode == 27) $("#popup_cancel").trigger('click');
                    });
                    $("#popup_cancel").keypress(function (e) {
                        if (e.keyCode == 13) $("#popup_cancel").trigger('click');
                        if (e.keyCode == 27) $("#popup_cancel").trigger('click');
                    });
                    if (value) $("#popup_prompt").val(value);
                    if ($.alerts.modal)bindmodel();
                    $("#popup_prompt").focus().select();

                    break;
            }


            // Make draggable
            if ($.alerts.draggable) {
                try {
                    $("#popup_container").draggable({ handle:$("#popup_title") });
                    $("#popup_title").css({ cursor:'move' });
                } catch (e) { /* requires jQuery UI draggables */
                }
            }
            return $("#popup_container");
        },
        _hide:function () {
            $("#popup_container").remove();
            if ($.alerts.modal)unbindmodel();
            $.alerts._overlay('hide');
        },
        _errtip:function (msg) {
            $("#popup_errortip").html(msg).show();
        },

        _overlay:function (status) {
            switch (status) {
                case 'show':
                    $.alerts._overlay('hide');

                    var o = $('<div id="popup_overlay"></div>').css({
                        position:'fixed',
                        zIndex:999,
                        top:0,
                        left:0,
                        width:'100%',
                        height:'100%',
                        background:$.alerts.overlayColor,
                        opacity:$.alerts.overlayOpacity
                    }).appendTo($("BODY"));
                    var ifra = $('<iframe src="javascript:false;document.write(\'\');" class="popup_overlayiframe"></iframe>').css({opacity:0});

                    var ie6 = $.browser.msie && ($.browser.version == "6.0") && !$.support.style;

                    if (ie6) {
                        o.html('<p style="width:100%;height:100%"/>').css("height", $(window).height()).css("width", $(window).width()).prepend(ifra);
                        o = o.css({position:'absolute'})[0];
                        try {
                            for (var y in {Top:1, Left:1})
                                o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'");
                        }
                        catch (e) {
                            ;
                        }

                    }
                    break;
                case 'hide':
                    $("#popup_overlay").remove();
                    break;
            }
        },

        //tiny alert
        _timeid:0,
        _overShow:function (msg, timespan) {
            timespan = timespan || 3000;
            $("#over_container").remove();
            $("body").append('<div id="over_container" style="display:none"><div id="over_message"></div></div>');
            $("#over_message").text(msg).html($("#over_message").text().replace(/\n/g, "<br />"));
            $("#over_container").show();
            clearTimeout(this._timeid);
            this._timeid = setTimeout(function (cb) {
                $("#over_container").hide("fast", function () {
                    $(this).remove();
                });
            }, timespan);
            return $("#over_container");
        },
        overAlert:function (msg, time) {
            return $.alerts._overShow(msg, time);
        },
        //end tiny alert

        _reposition:function () {
            var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
            var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
            if (top < 0) top = 0;
            if (left < 0) left = 0;

            // IE6 fix
            if ($.browser.msie && parseInt($.browser.version) <= 6) top = top + $(window).scrollTop();

            $("#popup_container").css({
                top:top + 'px',
                left:left + 'px'
            });
            $("#popup_overlay").height($(document).height());
        },

        _maintainPosition:function (status) {
            if ($.alerts.repositionOnResize) {
                switch (status) {
                    case true:
                        $(window).bind('resize', $.alerts._reposition);
                        break;
                    case false:
                        $(window).unbind('resize', $.alerts._reposition);
                        break;
                }
            }
        }

    }

    $.fn.mTipHide = function () {
        if ($(this).data("mtip")) {
            $(this).data("mtip").css("right", null);
            $(this).data("mtip").css("left", "-1000px");
        }
    };
    $.fn.mTip = function (msg, content, position) {
        var content = content || "";
        var _template = '<div class="eject_container"><div class="eject">'
            + '<p class="eject_position"></p>'
            + '<div class="eject_close btn_eject_close"><img title="关闭" src="http://images.mafengwo.net/images/wengweng/btn_close.gif" /></div>'
            + '<div>'
            + '<div class="eject_tit">' + msg + '</div>'
            + '<div class="eject_ts">' + content + '</div>'
            + '</div>'
            + '<div class="m_t_10">'
            + '</div>'
            + '</div></div>';

        return this.each(function () {
            var _p = $(this).offset();
            var _el = $(_template);
            if ($(this).data("mtip")) {
                if (position == "left") {
                    $(this).data("mtip").css("left", null);
                    $(this).data("mtip").css("right", $(this).data("pos") + 'px');
                }
                else {
                    $(this).data("mtip").css("left", $(this).data("pos") + 'px');
                }
                if (msg != "") {
                    $(this).data("mtip").find("div.eject_tit").html(msg);
                }
                if (content != "") {
                    $(this).data("mtip").find("div.eject_ts").html(content);
                }
                return;
            }
            $("BODY").append(_el);
            _el.hide().fadeIn("slow");
            _el.find(".btn_eject_close").click(function () {
                _el.css("right", null);
                _el.css("left", "-1000px");
            });

            if (position == "left") {
                var _r = ($(window).width() - _p.left) + 10;
                _el.find(".eject_position").addClass("eject_r");
                _el.css({
                    top:_p.top + 'px',
                    right:_r + 'px'
                });
                $(this).data("pos", _r);
            } else if (position == "bottom") {
                _el.find(".eject_position").addClass("eject_t");
                _el.css({
                    top:(_p.top + $(this).outerHeight()) + 10 + 'px',
                    left:_p.left + 'px'
                });
                $(this).data("pos", _p.left);
            } else if (position == "top") {
                _el.find(".eject_position").addClass("eject_b");
                _el.css({
                    top:(_p.top - _el.outerHeight()) - 10 + 'px',
                    left:_p.left + 'px'
                });
                $(this).data("pos", _p.left);
            }
            else {
                _el.find(".eject_position").addClass("eject_t");
                _el.css({
                    top:(_p.top + $(this).outerHeight()) + 10 + 'px',
                    left:_p.left + 'px'
                });
                $(this).data("pos", _p.left);
            }
            $(this).data("mtip", _el);

        });
    }
    // Shortuct 浮层 functions
    mAlert = function (message, title, callback, icon, hide_close) {
        return $.alerts.alert(message, title, callback, icon, hide_close);
    }

    mConfirm = function (message, callback, title, icon, hide_close) {
        return $.alerts.confirm(message, callback, title, icon, hide_close);
    };

    mPrompt = function (message, callback, value, title, hide_close) {
        return $.alerts.prompt(message, callback, value, title, hide_close);
    };

    mTinyAlert = function (message, time) {
        return $.alerts.overAlert(message, time)
    }

    mFloatPanel = function (html, position) {
        position = position || "top";
        return $("<div/>").appendTo($("body")).addClass("floatpanel").html(html).addClass("floatpanel" + position);
    }

    //ajax替换
    mAjaxReplace = function (obj, url, data, target) {
        if ($(obj).hasClass("moving"))return false;
        var target = target || "";
        if (target == "parent") {
            $(obj).parent().hide();
        }
        else {
            $(obj).hide();
        }
        $.post(url, data, function(data) {
            if (data.ret == 1) {
                if (target == "parent") {
                    $(obj).parent().replaceWith($(data.html).fadeIn(1500));
                }
                else {
                    $(obj).replaceWith($(data.html).fadeIn(1500,function () {
                        $(this).removeClass("moving");
                    }).addClass("moving"));//.fadeIn("slow");
                }
            }
            else {
                majaxerr(data);
            }
        }, 'json');
    }

    //截取字符串
    mSubStr = function (val, len) {
        var resVal = '';
        var byteValLen = 0;
        for (var i = 0; i < val.length; i++) {
            if (val[i].match(/[^\x00-\xff]/ig) != null)
                byteValLen += 2;
            else
                byteValLen += 1;
            if (byteValLen > len)
                break;
            resVal += val[i];
        }
        return resVal;
    };

    /**
     * 输入框中默认显示灰色文本
     * @param oConfig {Object} 配置参数，其结构为：
     * {
     *      text:{String} 默认文字,
     *      ziClass:{String} 文本默认显示的样式，默认为"gray"
     * }
     * @type jQuery
     * @example
     * 好友搜索输入框中默认灰色文本:"我要去看谁？"
     * $(".fc_input").inputDefault({
     *      text:_."我要去看谁？"
     * });
     */
    $.fn.inputDefault = function (oConfig) {
        var ziClass = oConfig.ziClass || "gray";
        if ($(this).val().length == 0)
            return this.focus(function () {
                if ($(this).hasClass(ziClass))$(this).val("").removeClass(ziClass);
            }).blur(function () {
                if ($.trim($(this).val()).length == 0)$(this).val(oConfig.text).addClass(ziClass);
            }).val(oConfig.text).addClass(ziClass);
    };
    /**
     * 背景切换
     * @param oConfig {Object} 配置参数，其结构为：
     * {
     *      url:{String} 要切换的图片
     * }
     * @type jQuery
     * @example
     * $(".img").img2Bg({
     *      url:"xxxx"
     * });
     */
    $.fn.img2Bg = function (oConfig) {
        var oConfig = oConfig || {};
        return this.each(function () {
            var _url = $(this).attr("img2") || oConfig.url || "";
            if (_url.length > 0) {
                $(this).data("ourl", $(this).attr("src"));
                $(this).mouseover(function () {
                    $(this).attr("src", _url);
                }).mouseout(function () {
                    $(this).attr("src", $(this).data("ourl"));
                }).parent().focus(function () {
                    $(this).trigger("blur")
                });
            }

        });
    };

    $.fn.selectInput = function (oConfig) {
        var ret = {};
        this.each(function () {
            var oConfig = oConfig || {};
            var def_val = oConfig.def || "0";
            var _sel = $(this);
            var _ipt = $(this);
            $(this).change(function () {
                if ($(this).val() == def_val) {
                    _ipt = $('<input type="text" />').attr("name", $(this).attr("name") + "_i").attr("id", $(this).attr("id") + "_i")
                        .insertAfter($(this)).dblclick(function () {
                            _sel.show().children(':first-child').attr("selected", "selected");
                            $(this).hide();
                        });
                    $(this).hide();
                }
            });

            ret.val = function () {
                if (_sel.is(':visible')) {
                    return _sel.val();
                }
                else {
                    return _ipt.val();
                }
            };


        });
        return ret;
    };

})(jQuery);

//分歧终端机挑战
var _vs_fans_times = -999;
function PK_n(times, defaultval, back) {
    var t = '<div class="vs_fans"><div class="oneline"><div class="p_tit">下注彩金：</div><div class="p_rcon"><span class="h2"><select id="select_tipmoney"name="select2"size="1"class="input"><option>1000</option><option>2000</option><option>5000</option><option>8000</option><option>10000</option><option value="0">自定义</option></select></span><span class="ts" id="vs_fans_times">今日还可免费发起<span class="coin_t">0</span>次</span></div></div><div class="oneline"><div class="p_tit">选择粉丝：</div><div class="p_rcon"><input type="text"name="textfield"class="to_suggest"/></div></div><div class="oneline"><div class="p_tit">选择出拳：</div><div class="p_rcon"><a id="btn_1"href="javascript:void(0)"><img val="2" img2="http://file.mafengwo.net/images/game/handwar/man_s1_on.gif"src="http://file.mafengwo.net/images/game/handwar/man_s1.gif"width="120"height="120"border="0"title="剪子"/></a><a id="btn_2"href="javascript:void(0)"><img val="5" img2="http://file.mafengwo.net/images/game/handwar/man_s2_on.gif"src="http://file.mafengwo.net/images/game/handwar/man_s2.gif"width="120"height="120"border="0"title="包袱"/></a><a id="btn_3"href="javascript:void(0)"><img val="0" src="http://file.mafengwo.net/images/game/handwar/man_s3.gif"img2="http://file.mafengwo.net/images/game/handwar/man_s3_on.gif"width="120"height="120"border="0"title="锤"/></a></div></div><div class="oneline"><div class="p_tit">附言：</div><div class="p_rcon"><textarea name="textfield2"class="textfield_tosay"style="width:360px;"></textarea></div></div></div><div class="clr3"></div>';

    var defaultval = defaultval || false;
    var picselected = false;
    var busy = false;
    var _touid = 0;

    if (_vs_fans_times == -999)_vs_fans_times = parseInt(times);
    if (parseInt(_vs_fans_times) <= -50) {
        mAlert("今天你不能挑战了，明天再来吧~~");
        return;
    }

    var obj = mAlert(t, "挑战我的粉丝",function () {
        var money = parseInt(sipt.val());
        if (isNaN(money) || money < 1000 || money > 10000) {
            return "请输入1000-10000的整数";
        }
        if (!picselected) {
            return "请选择出拳";
        }
        if (!defaultval && obj.find("input.input_viled").length == 0) {
            return "请选择粉丝";
        }
        if (!busy) {
            busy = true;
            var _wagerid = lastimg.val;
            var _uid = 0
            if (defaultval) {
                _uid = defaultval;
            }
            else {
                _uid = obj.find(".to_suggest").data("val");
            }

            var _msg = obj.find("textarea").val();
            //if(_msg=="就想和你赌一把！"){_msg=""};
            jQuery.getJSON("/ajax/ajax_wagerother.php", {touid:_uid, wagerid:_wagerid, challengeflg:"challenge", cash:money, msg:_msg}, function (dat) {
                if (dat.ret == 1) {
                    mTinyAlert(dat.msg || "操作成功！");
                    if (typeof(back) == "function")back(dat.usercash);
                }
                else {
                    mAlert(dat.msg || "操作失败！");
                }
                _vs_fans_times = parseInt(dat.leavenum);
                busy = false;
            });
        }
        return true;
    }, -1).css({width:"500px", marginLeft:"-250px"})
        .find("textarea").inputDefault({text:"就想和你赌一把！"}).end();
    if (defaultval) {
        obj.find(".to_suggest").parent().parent().remove();
    }
    else {
        obj.find(".to_suggest").suggest("/ajax/ajax_suggest.php?type=fans");
    }
    var sipt = obj.find("#select_tipmoney").selectInput();
    var lastimg = {};
    obj.find("img").click(function () {
        picselected = true;
        if (lastimg.url) {
            lastimg.obj.attr("src", lastimg.url);
        }
        lastimg.obj = jQuery(this);
        lastimg.url = jQuery(this).attr("src");
        lastimg.val = jQuery(this).attr("val");
        jQuery(this).attr("src", jQuery(this).attr("img2"));

    }).parent().focus(function () {
        jQuery(this).trigger("blur")
    });

    if (_vs_fans_times > 0) {
        jQuery("#vs_fans_times").html('今日还可免费发起<span class="coin_t">' + _vs_fans_times + '</span>次');
    }
    else if (_vs_fans_times > -50) {
        jQuery("#vs_fans_times").html('每交1000金币挑战1次，今日还可发起<span class="coin_t">' + (_vs_fans_times + 50) + '</span>次');
    }
    else {
        jQuery("#vs_fans_times").html('今日你不能发起挑战了');
    }


}


//suggest
(function ($) {

    $.suggest = function (input, options) {

        var $input = $(input).attr("autocomplete", "off");
        var $results;

        var timeout = false;		// hold timeout ID for suggestion results to appear
        var prevLength = 0;			// last recorded length of $input.val()
        var cache = [];				// cache MRU list
        var cacheSize = 0;			// size of cache in chars (bytes?)

        if ($.trim($input.val()) == '' || $.trim($input.val()) == '中文/拼音') $input.val('中文/拼音').css('color', '#aaa');
        if (!options.attachObject)
            options.attachObject = $(document.createElement("ul")).appendTo('body');

        $results = $(options.attachObject);
        $("." + options.resultsClass).remove();
        $results.addClass(options.resultsClass);

        resetPosition();
        $(window).scroll(function () {
            resetPosition();
        });
        $(window)
            .load(resetPosition)// just in case user is changing size of page while loading
            .resize(resetPosition);

        $input.blur(function () {
            setTimeout(function () {
                $results.hide();
            }, 200);
        });

        $input.focus(function () {
            if ($.trim($(this).val()) == '中文/拼音') {
                $(this).val('');//.css('color','#000');
            }
            resetPosition();
        });
        $input.click(function () {
            var q = $.trim($(this).val());
            displayItems(q);
            $(this).select();
        });

        // help IE users if possible
        try {
            $results.bgiframe();
        } catch (e) {
        }

        $input.keyup(processKey);//

        function resetPosition() {
            // requires jquery.dimension plugin
            var offset = $input.offset();
            $results.css({
                top:(offset.top + input.offsetHeight) + 'px',
                left:offset.left + 'px'
            });
        }


        function processKey(e) {

            // handling up/down/escape requires results to be visible
            // handling enter/tab requires that AND a result to be selected

            if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
                (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {

                if (e.preventDefault)
                    e.preventDefault();
                if (e.stopPropagation)
                    e.stopPropagation();

                e.cancelBubble = true;
                e.returnValue = false;

                switch (e.keyCode) {

                    case 38: // up
                        prevResult();
                        break;

                    case 40: // down
                        nextResult();
                        break;
                    case 13: // return
                        selectCurrentResult();
                        break;

                    case 27: //	escape
                        $results.hide();
                        break;

                }

            } else if ($input.val().length != prevLength) {
                $input.css('color', '#aaa').removeClass("input_viled");
                if (timeout)
                    clearTimeout(timeout);
                timeout = setTimeout(suggest, options.delay);
                prevLength = $input.val().length;

            }
            else {
                $results.show();
            }


        }

        //cache
        function checkCache(q) {
            for (var i = 0; i < cache.length; i++)
                if (cache[i]['k'] == q) {
                    cache.unshift(cache.splice(i, 1)[0]); // add to front to implement LRU
                    return cache[0]["items"];
                }
            return false;
        }

        function addToCache(q, size, items) {
            while (cache.length && (cacheSize + size > options.maxCacheSize)) {
                var cached = cache.pop();
                cacheSize -= cached['size'];
            }
            cache.push({
                k:q,
                size:size,
                items:items
            });
            cacheSize += size;
        }

        //cache end
        function suggest() {

            var q = $.trim($input.val());
            displayItems(q);
        }

        function handleJson(data, key) {
            var html = '';
            //alert(typeof(data));
            if (data.length) {
                for (var i = 0; i < data.length; i++) {
                    html += '<li rel="' + data[i].name + '"><img align="absmiddle" src="' + data[i].logo + '"/><span val="' + data[i].userid + '">' + data[i].name + '</span></li>';
                }
                html = '<div class="gray ac_result_tip">' + key + '，按拼音排序</div><ul>' + html + '</ul>';
            }
            else {
                suggest_tip = '<div class="gray ac_result_tip">对不起，找不到：' + key + '</div>';
                html = suggest_tip + '<ul>' + html + '</ul>';
            }
            displayRet(html);
        }

        function displayItems(key) {
            if (key != "") {
                var _d = checkCache(key);
                if (_d) {
                    handleJson(_d, key);
                }
                else {
                    $.getJSON(options.source, {k:key}, function (data) {
                        handleJson(data, key);
                        addToCache(key, data.length, data);
                    });
                }
            }
            else {
                displayRet('<div class="gray ac_result_tip">请输入中文/拼音或者↑↓选择</div>');
            }
            return;
        }

        function displayRet(html) {
            $results.html(html).show();
            $results.children('ul').children('li:first-child').addClass(options.selectClass);

            $results.children('ul')
                .children('li')
                .mouseover(function () {
                    $results.children('ul').children('li').removeClass(options.selectClass);
                    $(this).addClass(options.selectClass);
                })
                .click(function (e) {
                    e.preventDefault();
                    e.stopPropagation();
                    selectCurrentResult();
                });
        }

        function getCurrentResult() {

            if (!$results.is(':visible'))
                return false;

            var $currentResult = $results.children('ul').children('li.' + options.selectClass);
            if (!$currentResult.length)
                $currentResult = false;

            return $currentResult;

        }

        function selectCurrentResult() {

            $currentResult = getCurrentResult();

            if ($currentResult) {
                $input.val($currentResult.children('span').html().replace(/<span>.+?<\/span>/i, ''));
                $input.data("val", $currentResult.children('span').attr("val"));
                prevLength = $input.val().length;
                $results.hide();
                $input.css('color', '#000').addClass("input_viled");
                if ($(options.dataContainer)) {
                    $(options.dataContainer).val($currentResult.attr('rel'));
                }

                if (options.onSelect) {
                    options.onSelect.apply($input[0], [$currentResult.children('span').attr("val")]);
                }
            }

        }

        function nextResult() {

            $currentResult = getCurrentResult();

            if ($currentResult && $currentResult.next().length) {
                $currentResult
                    .removeClass(options.selectClass)
                    .next()
                    .addClass(options.selectClass);
            }
            else
                $results.children('ul').children('li:last-child').removeClass(options.selectClass).end().children('li:first-child').addClass(options.selectClass);

        }

        function prevResult() {

            $currentResult = getCurrentResult();

            if ($currentResult && $currentResult.prev().length)
                $currentResult
                    .removeClass(options.selectClass)
                    .prev()
                    .addClass(options.selectClass);
            else
                $results.children('ul').children('li:first-child').removeClass(options.selectClass).end().children('li:last-child').addClass(options.selectClass);

        }

    }

    $.fn.suggest = function (source, options) {

        if (!source)
            return;

        options = options || {};
        options.source = source;
        options.hot_list = options.hot_list || [];
        options.delay = options.delay || 200;
        options.resultsClass = options.resultsClass || 'ac_results';
        options.selectClass = options.selectClass || 'ac_over';
        options.matchClass = options.matchClass || 'ac_match';
        options.minchars = options.minchars || 1;
        options.delimiter = options.delimiter || '\n';
        options.onSelect = options.onSelect || false;
        options.dataDelimiter = options.dataDelimiter || '\t';
        options.dataContainer = options.dataContainer || '#SuggestResult';
        options.attachObject = options.attachObject || null;
        options.maxCacheSize = 65536;

        this.each(function () {
            new $.suggest(this, options);
        });

        return this;

    };

})(jQuery);

//图片上传
if (jQuery)(function (jQuery) {
    jQuery.extend(jQuery.fn, {
        uploadify:function (options) {
            jQuery(this).each(function () {
                settings = jQuery.extend({
                    id:jQuery(this).attr('id'), // The ID of the object being Uploadified
                    uploader:'uploadify.swf', // The path to the uploadify swf file
                    script:'uploadify.php', // The path to the uploadify backend upload script
                    expressInstall:null, // The path to the express install swf file
                    folder:'', // The path to the upload folder
                    height:21, // The height of the flash button
                    width:52, // The width of the flash button
                    cancelImg:'cancel.png', // The path to the cancel image for the default file queue item container
                    wmode:'opaque', // The wmode of the flash file
                    scriptAccess:'sameDomain', // Set to "always" to allow script access across domains
                    fileDataName:'Filedata', // The name of the file collection object in the backend upload script
                    method:'POST', // The method for sending variables to the backend upload script
                    queueSizeLimit:1, // The maximum size of the file queue
                    simUploadLimit:1, // The number of simultaneous uploads allowed
                    queueID:false, // The optional ID of the queue container
                    displayData:'percentage', // Set to "speed" to show the upload speed in the default queue item
                    onInit:function () {
                    }, // Function to run when uploadify is initialized
                    onSelect:function () {
                    }, // Function to run when a file is selected
                    onQueueFull:function () {
                    }, // Function to run when the queue reaches capacity
                    onCheck:function () {
                    }, // Function to run when script checks for duplicate files on the server
                    onCancel:function () {
                    }, // Function to run when an item is cleared from the queue
                    onError:function () {
                    }, // Function to run when an upload item returns an error
                    onProgress:function () {
                    }, // Function to run each time the upload progress is updated
                    onComplete:function () {
                    }, // Function to run when an upload is completed
                    onAllComplete:function () {
                    }  // Functino to run when all uploads are completed
                }, options);
                var pagePath = location.pathname;
                pagePath = pagePath.split('/');
                pagePath.pop();
                pagePath = pagePath.join('/') + '/';
                var data = {};
                data.uploadifyID = settings.id;
                data.pagepath = pagePath;
                if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
                if (settings.buttonText) data.buttonText = escape(settings.buttonText);
                if (settings.rollover) data.rollover = true;
                data.script = settings.script;
                data.folder = escape(settings.folder);
                if (settings.scriptData) {
                    var scriptDataString = '';
                    for (var name in settings.scriptData) {
                        scriptDataString += '&' + name + '=' + settings.scriptData[name];
                    }
                    data.scriptData = escape(scriptDataString.substr(1));
                }
                data.width = settings.width;
                data.height = settings.height;
                data.wmode = settings.wmode;
                data.method = settings.method;
                data.queueSizeLimit = settings.queueSizeLimit;
                data.simUploadLimit = settings.simUploadLimit;
                if (settings.hideButton)   data.hideButton = true;
                if (settings.fileDesc)     data.fileDesc = settings.fileDesc;
                if (settings.fileExt)      data.fileExt = settings.fileExt;
                if (settings.multi)        data.multi = true;
                if (settings.auto)         data.auto = true;
                if (settings.sizeLimit)    data.sizeLimit = settings.sizeLimit;
                if (settings.checkScript)  data.checkScript = settings.checkScript;
                if (settings.fileDataName) data.fileDataName = settings.fileDataName;
                if (settings.queueID)      data.queueID = settings.queueID;
                if (settings.onInit() !== false) {
                    jQuery(this).css('display', 'none');
                    jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');
                    swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high', 'wmode':settings.wmode, 'allowScriptAccess':settings.scriptAccess});
                    if (settings.queueID == false) {
                        jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');
                    }
                }
                if (typeof(settings.onOpen) == 'function') {
                    jQuery(this).bind("uploadifyOpen", settings.onOpen);
                }
                jQuery(this).bind("uploadifySelect", {'action':settings.onSelect, 'queueID':settings.queueID}, function (event, ID, fileObj) {
                    if (event.data.action(event, ID, fileObj) !== false) {
                        var byteSize = Math.round(fileObj.size / 1024 * 100) * .01;
                        var suffix = 'KB';
                        if (byteSize > 1000) {
                            byteSize = Math.round(byteSize * .001 * 100) * .01;
                            suffix = 'MB';
                        }
                        var sizeParts = byteSize.toString().split('.');
                        if (sizeParts.length > 1) {
                            byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0, 2);
                        } else {
                            byteSize = sizeParts[0];
                        }
                        if (fileObj.name.length > 16) {
                            fileName = fileObj.name.substr(0, 15) + '...';
                        } else {
                            fileName = fileObj.name;
                        }
                        queue = '#' + jQuery(this).attr('id') + 'Queue';
                        if (event.data.queueID) {
                            queue = '#' + event.data.queueID;
                        }
                        jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\
								<div class="cancel">\
									<!--<a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>-->\
								</div>\
								<span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\
								<div class="uploadifyProgress">\
									<div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
								</div>\
							</div>');
                    }
                });
                if (typeof(settings.onSelectOnce) == 'function') {
                    jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce);
                }
                jQuery(this).bind("uploadifyQueueFull", {'action':settings.onQueueFull}, function (event, queueSizeLimit) {
                    if (event.data.action(event, queueSizeLimit) !== false) {
                        alert('The queue is full.  The max size is ' + queueSizeLimit + '.');
                    }
                });
                jQuery(this).bind("uploadifyCheckExist", {'action':settings.onCheck}, function (event, checkScript, fileQueueObj, folder, single) {
                    var postData = new Object();
                    postData = fileQueueObj;
                    postData.folder = pagePath + folder;
                    if (single) {
                        for (var ID in fileQueueObj) {
                            var singleFileID = ID;
                        }
                    }
                    jQuery.post(checkScript, postData, function (data) {
                        for (var key in data) {
                            if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) {
                                var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
                                if (!replaceFile) {
                                    document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true, true);
                                }
                            }
                        }
                        if (single) {
                            document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);
                        } else {
                            document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);
                        }
                    }, "json");
                });
                jQuery(this).bind("uploadifyCancel", {'action':settings.onCancel}, function (event, ID, fileObj, data, clearFast) {
                    if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
                        var fadeSpeed = (clearFast == true) ? 0 : 250;
                        jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function () {
                            jQuery(this).remove()
                        });
                    }
                });
                if (typeof(settings.onClearQueue) == 'function') {
                    jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue);
                }
                var errorArray = [];
                jQuery(this).bind("uploadifyError", {'action':settings.onError}, function (event, ID, fileObj, errorObj) {
                    if (event.data.action(event, ID, fileObj, errorObj) !== false) {
                        var fileArray = new Array(ID, fileObj, errorObj);
                        errorArray.push(fileArray);
                        jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error");
                        jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
                    }
                });
                jQuery(this).bind("uploadifyProgress", {'action':settings.onProgress, 'toDisplay':settings.displayData}, function (event, ID, fileObj, data) {
                    if (event.data.action(event, ID, fileObj, data) !== false) {
                        jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%');
                        if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
                        if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
                        if (event.data.toDisplay == null) displayData = ' ';
                        jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData);
                    }
                });
                jQuery(this).bind("uploadifyComplete", {'action':settings.onComplete}, function (event, ID, fileObj, response, data) {
                    if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
                        jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed');
                        jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function () {
                            jQuery(this).remove()
                        });
                    }
                });
                if (typeof(settings.onAllComplete) == 'function') {
                    jQuery(this).bind("uploadifyAllComplete", {'action':settings.onAllComplete}, function (event, uploadObj) {
                        if (event.data.action(event, uploadObj) !== false) {
                            errorArray = [];
                        }
                    });
                }
            });
        },
        uploadifySettings:function (settingName, settingValue, resetObject) {
            var returnValue = false;
            jQuery(this).each(function () {
                if (settingName == 'scriptData' && settingValue != null) {
                    if (resetObject) {
                        var scriptData = settingValue;
                    } else {
                        var scriptData = jQuery.extend(settings.scriptData, settingValue);
                    }
                    var scriptDataString = '';
                    for (var name in scriptData) {
                        scriptDataString += '&' + name + '=' + escape(scriptData[name]);
                    }
                    settingValue = scriptDataString.substr(1);
                }
                returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
            });
            if (settingValue == null) {
                if (settingName == 'scriptData') {
                    var returnSplit = unescape(returnValue).split('&');
                    var returnObj = new Object();
                    for (var i = 0; i < returnSplit.length; i++) {
                        var iSplit = returnSplit[i].split('=');
                        returnObj[iSplit[0]] = iSplit[1];
                    }
                    returnValue = returnObj;
                }
                return returnValue;
            }
        },
        uploadifyUpload:function (ID) {
            jQuery(this).each(function () {
                document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false);
            });
        },
        uploadifyCancel:function (ID) {
            jQuery(this).each(function () {
                document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false);
            });
        },
        uploadifyClearQueue:function () {
            jQuery(this).each(function () {
                document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);
            });
        }
    })
})(jQuery);

//Select
(function ($) {
    $.fn.slt = function (obj, arr) {
        return this.each(function () {
            var iptName;
            var _text = "";
            $(this).click(clk);
            function clk() {
                $("#liandong_select ul li").die();
                $("#liandong_select").remove();
                iptName = $(this).attr("id");
                var iptOffSet = $(this).offset();
                var iptLeft = iptOffSet.left;
                var iptTop = iptOffSet.top + 20;
                var str = "<div id='liandong_select'><span><a id='fh'>返回顶层列表</a><a id='gb'>[&nbsp;关闭&nbsp;]</a></span><div class='c'><ul></ul></div><div style='clear:both;'></div></div>";
                areasLen = arr.length;
                var str2 = "";
                for (var i = 0; i < areasLen; i++) {
                    str2 = str2 + "<li title='" + arr[i][1] + "' id='p" + arr[i][0] + "'>" + arr[i][1] + "</li>";
                }
                $("body").append(str);
                $("#liandong_select ul").append(str2);
                $("#liandong_select").css({left:iptLeft + "px", top:iptTop + "px"});
                $("#liandong_select span a#fh").bind("click", function () {
                    $("#liandong_select ul").empty();
                    $("#liandong_select ul").append(str2);
                    _text = "";
                });
                $("#liandong_select span a#gb").bind("click", function () {
                    $("#liandong_select").remove();
                });
                $("#liandong_select ul li").live("click", liBind);
            }

            function liBind() {
                var liId = $(this).attr("id");
                var liText = _text.length > 0 ? _text + ">" + $(this).text() : $(this).text();
                _text = liText;
                var newArrVal = obj[liId];
                if (newArrVal == undefined || newArrVal == "") {
                    $("#" + iptName + "Val").val(liId.substr(1));
                    $("#" + iptName).val(liText);
                    $("#liandong_select").css("display", "none");
                    _text = "";
                }
                else {
                    listr = "";
                    pLen = newArrVal.length;
                    for (j = 0; j < pLen; j++) {
                        if ("p" + newArrVal[j][0] == liId) {
                            listr = listr + "<li title='" + newArrVal[j][1] + "' id='p" + newArrVal[j][0] + "' >" + newArrVal[j][1] + "</li>";
                        }
                        else listr = listr + "<li title='" + newArrVal[j][1] + "' id='p" + newArrVal[j][0] + "'>" + newArrVal[j][1] + "</li>";
                    }
                    $("#liandong_select ul").empty();
                    $("#liandong_select ul").append(listr);
                }
            }
        });
    };
})(jQuery);

//加金币效果
(function ($) {
    $.fn.UpNum = function (num, callback, font_size,z_index) {
        return this.each(function () {
            var _p = $(this).offset();
            var _x = Math.round(_p.left) + "px";
            var _y = Math.round(_p.top) + "px";
            if (num.toString().indexOf("-") == 0) {
                var _y1 = Math.round(_p.top) + 30 + "px";
            } else {
                var _y1 = Math.round(_p.top) - 30 + "px";
            }
            var fs = "20px";
            if (font_size)fs = font_size;
            z_index = z_index || "120";
            var _m = num || $(this).attr("money");
            $("<div/>").appendTo($("body")).addClass("numeric").css({position:"absolute", top:_y, left:_x, color:(num.toString().indexOf("-") == 0) ? "#333" : "red", "fontFamily":"Georgia", "fontSize":fs, "zIndex":z_index}).html(_m)
                .animate({ top:_y1 }, {duration:1000, complete:function () {
                    $(this).remove();
                    if (callback) {
                        callback();
                    }
                }});
        });
    };
})(jQuery);

(function ($) {
    //加关注
    adf = function (obj, uid, flg) {
        mAjaxReplace(obj, "/ajax/addfriend.php", {action: 'addfollow', type: flg, touid: uid, '_need_cstk':true});
    }
    //取消关注
    def = function (obj, uid, flg) {
        mAjaxReplace(obj, "/ajax/addfriend.php", {action: 'delfriend', type: flg, touid: uid, '_need_cstk':true});
    }
    //留言
    m_lmsg = function (obj, para, position) {
        var _p = {
            url:"/ajax/ajax_send.php",
            content:"",
            _need_cstk:true
        }
        if (!position)position = "bottom";
        if (typeof(para) == "object")$.extend(_p, para);
        var _isprivate = (typeof(_p.word) != "undefined");
        var _cc = '';
        if (_isprivate && false) {
            _cc = '<textarea class="atsb_input">' + _p.word + '</textarea><div class="atsb_h35"><div class="flt1"><input type="checkbox" value=""/>&nbsp;&nbsp;悄悄话</div><div class="flt2"><input type="button" class="btn_orange" value="确定"/></div></div>';
        }
        else {
            _cc = '<textarea class="atsb_input"></textarea><input type="button" class="btn_orange" value="确定"/>';
        }

        $(obj).mTip("<div class='atsb_tit'>留言</div>", _cc, position).data("mtip").find("div.eject").css("width", 270).find("input.btn_orange").click(function () {
            var _content = $.trim($(obj).data("mtip").find("textarea").val());
            var _privatestate = $(obj).data("mtip").find(":checked").length;
            if (_privatestate && true) {
                _p.type = "msg";
            }
            if (_content.length > 0) {
                $.extend(_p, {content:_content});
                $.post(_p.url, _p, function (d) {
                    if (d.ret == 1) {
                        $(obj).mTipHide();
                        mTinyAlert("操作成功！");
                    }
                    else {
                        majaxerr(d);
                    }

                }, 'json');
            }
            else {
                mAlert("你还是写俩字吧");
            }
        }).end().find(":checkbox").click(function () {
            var _v = $(obj).data("mtip").find("textarea").val().replace(_p.word, "");
            if (!$(this).is(":checked")) {

                $(obj).data("mtip").find("textarea").val(_p.word + _v);
            }
            else {
                $(obj).data("mtip").find("textarea").val(_v);
            }
        });
        setTimeout(function () {
            $(obj).data("mtip").find("textarea").trigger("focus")[0].value += "";
        }, 20);
    }
    //消息
    m_smsg = function (obj, para) {
        var _p = {
            url:"/ajax/ajax_send.php",
            _need_cstk:true
        }
        if (typeof(para) == "object")$.extend(_p, para);
        $(obj).mTip("<div class='atsb_tit'>发送消息</div>", '<textarea class="atsb_input"></textarea><div class="atsb_h35"><input type="button" class="btn_orange" value="确定"/></div>', "bottom").data("mtip").find("div.eject").css("width", 270).find("input.btn_orange").click(function () {
            var _content = $.trim($(this).parent().prev().val());
            if (_content.length > 0) {
                $.extend(_p, {content:_content});
                $.post(_p.url, _p, function (d) {
                    if (d.ret == 1) {
                        $(obj).mTipHide();
                        mTinyAlert("操作成功！");
                    }
                    else {
                        majaxerr(d);
                    }

                }, 'json');

            }
            else {
                mAlert("空消息是不能发送的");
            }
        });
    }
})(jQuery);
//ajax错误处理
function majaxerr(d, callback) {
    if (d.ret == "-1") {
        window.location.href = "http://passport.mafengwo.cn";
    }
    else {
        mAlert("<div class=''>" + (d.msg || jQuery.asset.Err) + "</div>", "", function () {
            if (typeof(callback) == "function") {
                callback();
            }
        });

    }
}

//jquery动画
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend(jQuery.easing,
    {
        def:'easeOutQuad',
        swing:function (x, t, b, c, d) {
            //alert(jQuery.easing.default);
            return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
        },
        easeInQuad:function (x, t, b, c, d) {
            return c * (t /= d) * t + b;
        },
        easeOutQuad:function (x, t, b, c, d) {
            return -c * (t /= d) * (t - 2) + b;
        },
        easeInOutQuad:function (x, t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t + b;
            return -c / 2 * ((--t) * (t - 2) - 1) + b;
        },
        easeInCubic:function (x, t, b, c, d) {
            return c * (t /= d) * t * t + b;
        },
        easeOutCubic:function (x, t, b, c, d) {
            return c * ((t = t / d - 1) * t * t + 1) + b;
        },
        easeInOutCubic:function (x, t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
            return c / 2 * ((t -= 2) * t * t + 2) + b;
        },
        easeInQuart:function (x, t, b, c, d) {
            return c * (t /= d) * t * t * t + b;
        },
        easeOutQuart:function (x, t, b, c, d) {
            return -c * ((t = t / d - 1) * t * t * t - 1) + b;
        },
        easeInOutQuart:function (x, t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
            return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
        },
        easeInQuint:function (x, t, b, c, d) {
            return c * (t /= d) * t * t * t * t + b;
        },
        easeOutQuint:function (x, t, b, c, d) {
            return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
        },
        easeInOutQuint:function (x, t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
            return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
        },
        easeInSine:function (x, t, b, c, d) {
            return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
        },
        easeOutSine:function (x, t, b, c, d) {
            return c * Math.sin(t / d * (Math.PI / 2)) + b;
        },
        easeInOutSine:function (x, t, b, c, d) {
            return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
        },
        easeInExpo:function (x, t, b, c, d) {
            return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
        },
        easeOutExpo:function (x, t, b, c, d) {
            return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
        },
        easeInOutExpo:function (x, t, b, c, d) {
            if (t == 0) return b;
            if (t == d) return b + c;
            if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
            return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
        },
        easeInCirc:function (x, t, b, c, d) {
            return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
        },
        easeOutCirc:function (x, t, b, c, d) {
            return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
        },
        easeInOutCirc:function (x, t, b, c, d) {
            if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
            return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
        },
        easeInElastic:function (x, t, b, c, d) {
            var s = 1.70158;
            var p = 0;
            var a = c;
            if (t == 0) return b;
            if ((t /= d) == 1) return b + c;
            if (!p) p = d * .3;
            if (a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            }
            else var s = p / (2 * Math.PI) * Math.asin(c / a);
            return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        },
        easeOutElastic:function (x, t, b, c, d) {
            var s = 1.70158;
            var p = 0;
            var a = c;
            if (t == 0) return b;
            if ((t /= d) == 1) return b + c;
            if (!p) p = d * .3;
            if (a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            }
            else var s = p / (2 * Math.PI) * Math.asin(c / a);
            return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
        },
        easeInOutElastic:function (x, t, b, c, d) {
            var s = 1.70158;
            var p = 0;
            var a = c;
            if (t == 0) return b;
            if ((t /= d / 2) == 2) return b + c;
            if (!p) p = d * (.3 * 1.5);
            if (a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            }
            else var s = p / (2 * Math.PI) * Math.asin(c / a);
            if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
            return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
        },
        easeInBack:function (x, t, b, c, d, s) {
            if (s == undefined) s = 1.70158;
            return c * (t /= d) * t * ((s + 1) * t - s) + b;
        },
        easeOutBack:function (x, t, b, c, d, s) {
            if (s == undefined) s = 1.70158;
            return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
        },
        easeInOutBack:function (x, t, b, c, d, s) {
            if (s == undefined) s = 1.70158;
            if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
            return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
        },
        easeInBounce:function (x, t, b, c, d) {
            return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b;
        },
        easeOutBounce:function (x, t, b, c, d) {
            if ((t /= d) < (1 / 2.75)) {
                return c * (7.5625 * t * t) + b;
            } else if (t < (2 / 2.75)) {
                return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
            } else if (t < (2.5 / 2.75)) {
                return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
            } else {
                return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
            }
        },
        easeInOutBounce:function (x, t, b, c, d) {
            if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
            return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
        }
    });

//ajax获取提示
function mGetTip(para) {
    var _p = {url:"/recnew/ajax_addfds.php"};
    jQuery.extend(_p, para);
    jQuery.post(_p.url, _p, function (d) {
        if (d.ret == 1) {
            mTinyAlert(d.msg);
            if (_p.reload) {
                setTimeout(function () {
                    top.location.reload();
                }, 1000);
            }
        }
        else {
            majaxerr(d);
        }
    }, "json");
}

//马蜂窝广告
(function ($) {
    mGG = function (cnt, w) {
        w += 4;
        $("<div class='mfwGG'><div class='mfwGGContent'>" + cnt + "</div><a alt='关闭' href='javascript:void(0)' class='mfwGGCloseBtn'>关闭</a></div>").appendTo($('body')).css({"width":w + "px", "marginLeft":"-" + w / 2 + "px"}).find(".mfwGGCloseBtn").click(function () {
            $(this).parent().fadeOut(400, function () {
                $(this).remove();
                $.alerts._overlay('hide');
            })
        });
        $.alerts._overlay('show');
    };

    Ding = function (iid, num, thisid, obj) {
        $(obj).blur();
        if(!$(obj).data('inited')) {
            if($(obj).closest('.float-bar').size() > 0) {
                $("#float_topvote" + thisid).UpNum('+1', function() {
                    $("#float_topvote" + thisid).html(num + 1);
                });
            }
            $("#topvote" + thisid).UpNum('+1', function() {
                $("#topvote" + thisid).html(num + 1);
            });
            $.post('/group/ajax_infovote.php', {iid: iid}, function(d) {

            }, 'json');
        }
        $(obj).data('inited', true);
    }

    PH = function (select) {
        return;
        jQuery(select).hover(function () {

                //if(jQuery(this).data("atip")){jQuery(this).data("atip").stop().remove();}
                jQuery(this).attr({title:''});
                var _of = jQuery(this).offset();
                var _json = eval("(" + jQuery(this).attr("tip") + ")");
                var _sextxt = "神秘人士";
                if (_json.city != "")_json.city += "的";
                if (_json.sex == 1) {
                    _sextxt = "帅哥";
                }
                if (_json.sex == 0) {
                    _sextxt = "美女";
                }
                var _atip = jQuery("<div class='mfwPH'><div class='mfwPHContent'><img align='middle' width='48' border='0' height='48' src='" + _json.logo + "'/></div><div class='mfwPHContentTxt'>" + _json.city + _sextxt + "</div></div>").appendTo(jQuery('body'));
                _atip.css({
                    position:'absolute',
                    zIndex:'50000',
                    top:(_of.top - _atip.outerHeight()) + 'px',
                    left:(_of.left + jQuery(this).outerWidth()) + 'px'
                }).fadeIn(400);
                jQuery(this).data("atip", _atip);
                return;
                _atip.css({
                    position:'absolute',
                    display:'none',
                    zIndex:'50000',
                    top:(jQuery(this).offset().top - _atip.outerHeight()) + 'px',
                    left:(jQuery(this).offset().left + _atip.outerWidth()) + 'px'
                })
                    .stop().fadeIn(400);

                jQuery(this).data("atip", _atip);
            },
            function () {
                jQuery(this).data("atip").remove();
            });
    }
})(jQuery);

//分页控件
(function ($) {
    var _configall = {
        "default":{
            template:{
                container:'<div align="right" class="paginator"></div>',
                loop:'<a class="ti" href="{url}" style="margin:2px;">{page}</a>',
                firstpage:'<a class="ti" href="{url}"><< First</a>',
                lastpage:'<a class="ti" href="{url}">Next >></a>',
                dot:"<a class=\"ti\" href=\"javascript:void(0)\">…</a>"
            },
            /**
             * 配置和初始化翻页控件
             * @param t {Object} 模板
             * @param j {jQuery} 翻页控件的容器对象
             * @param opt {Object} 翻页控件配置参数
             */
            handle:function (t, j, opt) {
                opt.recordcount = parseInt(opt.recordcount);
                opt.pagesize = parseInt(opt.pagesize);
                opt.nowpage = parseInt(opt.nowpage);
                var _pnum = Math.floor(opt.recordcount / opt.pagesize) + (opt.recordcount % opt.pagesize ? 1 : 0);
                if (_pnum < 2)return;
                opt.nowpage = opt.nowpage > _pnum ? _pnum : opt.nowpage;
                var _c = $(t.container);
                var _fp = $(t.firstpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, 1)));
                var _lp = $(t.lastpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, opt.nowpage == _pnum ? opt.nowpage : opt.nowpage + 1)));
                if (opt.nowpage > 1) {
                    _c.append(_fp);
                }
                var _start = 1, _end = _pnum, _ismore = false, _lmore = true, _rmore = true;
                if (_pnum > 10) {
                    _end = opt.nowpage + 4;
                    _start = opt.nowpage - 4;
                    if (opt.nowpage + 4 >= _pnum) {
                        _end = _pnum;
                        _start = _end - 8;
                        _rmore = false;
                    }
                    if (opt.nowpage - 4 <= 1) {
                        _start = 1;
                        _end = _start + 8;
                        _lmore = false;
                    }
                    _ismore = true;

                }
                for (var i = _start, loopindex = 1; i <= _end; i++, loopindex++) {
                    var _loop;
                    if (_ismore) {
                        _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, i)).replace(/{page}/g, i));
                        if ($.inArray(loopindex, [1, 2]) > -1) {
                            _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, loopindex)).replace(/{page}/g, loopindex));
                        }
                        if ($.inArray(loopindex, [8, 9]) > -1) {
                            _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, _pnum + loopindex - 9)).replace(/{page}/g, _pnum + loopindex - 9));
                        }

                        if (loopindex == 3 && _lmore) {
                            _c.append($(t.dot));
                        }
                        if (loopindex == 8 && _rmore) {
                            _c.append($(t.dot));
                        }
                    }
                    else {
                        _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, i)).replace(/{page}/g, i));
                    }
                    if (i == opt.nowpage) {
                        _loop.css({"background-color":"#946400", "border":"1px solid #8B4505", "color":"#FFFFFF"}).attr("href", "javascript:void(0)");
                    }
                    _c.append(_loop);
                }
                if (opt.nowpage < _pnum) {
                    _c.append(_lp);
                }
                j.html("");
                $(_c).appendTo(j);
            }
        },
        "tiny":{
            template:{
                container:'<div align="right" class="paginator"></div>',
                firstpage:'<a class="ti" href="{url}">&lt;&lt;</a>',
                lastpage:'<a class="ti" href="{url}">&gt;&gt;</a>',
                loop:'<a class="ti" href="{url}" style="margin:2px;">{page}</a>'
            },
            /**
             * 配置和初始化翻页控件
             * @param t {Object} 模板
             * @param j {jQuery} 翻页控件的容器对象
             * @param opt {Object} 翻页控件配置参数
             */
            handle:function (t, j, opt) {
                opt.recordcount = parseInt(opt.recordcount);
                opt.pagesize = parseInt(opt.pagesize);
                opt.nowpage = parseInt(opt.nowpage);
                var _pnum = Math.floor(opt.recordcount / opt.pagesize) + (opt.recordcount % opt.pagesize ? 1 : 0);
                if (_pnum < 2)return;
                opt.nowpage = opt.nowpage > _pnum ? _pnum : opt.nowpage;
                var _c = $(t.container);
                var _fp = $(t.firstpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, 1)));
                var _lp = $(t.lastpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, opt.nowpage == _pnum ? opt.nowpage : opt.nowpage + 1)));
                if (opt.nowpage > 1) {
                    _c.append(_fp);
                }

                var _start = 1, _end = _pnum, showmore = false;
                if (_pnum > 5) {
                    showmore = true;
                    _end = opt.nowpage + 2;
                    _start = opt.nowpage - 2;
                    if (opt.nowpage + 2 >= _pnum) {
                        _end = _pnum;
                        _start = _end - 4;
                        showmore = false;
                    }
                    if (opt.nowpage - 2 <= 1) {
                        _start = 1;
                        _end = _start + 4;
                    }
                }
                for (var i = _start; i <= _end; i++) {
                    _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, i)).replace(/{page}/g, i));
                    if (i == opt.nowpage) {
                        _loop.css({"background-color":"#946400", "border":"1px solid #8B4505", "color":"#FFFFFF"}).attr("href", "javascript:void(0)");
                    }
                    _c.append(_loop);
                }

                if (showmore) {
                    var morep = opt.nowpage + 5;
                    if (morep > _pnum)morep = _pnum;
                    _c.append('<a class="ti" style="margin:2px;" href="' + buildUrl(opt.url, opt.pageparameter, morep) + '">...</a>');
                }

                if (opt.nowpage < _pnum) {
                    _c.append(_lp);
                }
                j.html("");
                $(_c).appendTo(j);
            }
        },
        "index":{
            template:{
                container:'<div align="right" class="paginator"></div>',
                firstpage:'<a class="ti" href="{url}">&lt;&lt;prev</a>',
                lastpage:'<a class="ti" href="{url}">next&gt;&gt;</a>',
                loop:'<a class="ti" href="{url}" style="margin:2px;">{page}</a>'
            },
            /**
             * 配置和初始化翻页控件
             * @param t {Object} 模板
             * @param j {jQuery} 翻页控件的容器对象
             * @param opt {Object} 翻页控件配置参数
             */
            handle:function (t, j, opt) {
                opt.recordcount = parseInt(opt.recordcount);
                opt.pagesize = parseInt(opt.pagesize);
                opt.nowpage = parseInt(opt.nowpage);
                var _pnum = Math.floor(opt.recordcount / opt.pagesize) + (opt.recordcount % opt.pagesize ? 1 : 0);
                if (_pnum < 2)return;
                opt.nowpage = opt.nowpage > _pnum ? _pnum : opt.nowpage;
                var _c = $(t.container);
                var _fp = $(t.firstpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, opt.nowpage - 1)));
                var _lp = $(t.lastpage.replace(/{url}/, buildUrl(opt.url, opt.pageparameter, opt.nowpage == _pnum ? opt.nowpage : opt.nowpage + 1)));
                if (opt.nowpage > 1) {
                    _c.append(_fp);
                }

                var _start = 1, _end = _pnum, showmore = false;
                if (_pnum > 9) {
                    showmore = true;
                    _end = opt.nowpage + 4;
                    _start = opt.nowpage - 4;
                    if (opt.nowpage + 4 >= _pnum) {
                        _end = _pnum;
                        _start = _end - 8;
                        showmore = false;
                    }
                    if (opt.nowpage - 4 <= 1) {
                        _start = 1;
                        _end = _start + 8;
                    }
                }
                for (var i = _start; i <= _end; i++) {
                    _loop = $(t.loop.replace(/{url}/g, buildUrl(opt.url, opt.pageparameter, i)).replace(/{page}/g, i));
                    if (i == opt.nowpage) {
                        _loop.css({"background-color":"#946400", "border":"1px solid #8B4505", "color":"#FFFFFF"}).attr("href", "javascript:void(0)");
                    }
                    _c.append(_loop);
                }

                if (showmore) {
                    var morep = opt.nowpage + 9;
                    if (morep > _pnum)morep = _pnum;
                    _c.append('<a class="ti" style="margin:2px;" href="' + buildUrl(opt.url, opt.pageparameter, morep) + '">...</a>');
                }

                if (opt.nowpage < _pnum) {
                    _c.append(_lp);
                }
                j.html("");
                $(_c).appendTo(j);
            }
        }
    };

    /**
     * 构造翻页时请求的url
     * @param url {String} 翻页时需请求的url
     * @param pageparameter {String} 页码参数名称
     * @param page {Number} 页码
     * @return 翻页时请求的url，包含页码参数
     * @type String
     */
    function buildUrl(url, pageparameter, page) {
        var reg = new RegExp("([?&])" + pageparameter + "=\\d*", "g");
        url = url.replace(reg, "$1");
        return (url + (url.indexOf("?") > -1 ? "&" : "?") + pageparameter + "=" + page).replace(/&+/g, "&").replace(/\?&/g, "?");
    }

    /**
     * 翻页控件
     * @param opt {Object} 配置参数：
     * {
     *      pagesize:{Number} 每页显示记录条数(默认10),
     *      nowpage:{Number} 当前页码(默认1),
     *      recordcount:{Number} 总记录数,
     *      url:{String} 链接(默认当前请求url) ,
     *      pageparameter:{String} 页数的参数名(默认"page"),
     *      config:{String} 要读取的配置（扩展用，默认"default"）
     * }
     * @type jQuery
     * @example
     * 分享信息翻页显示
     * $("#pager_num1").Pager({recordcount: 91,pagesize: 25,nowpage: 1,url: "/mblog/share/all",pageparameter:"p"});
     * @author WangHao 分页控件V1.0 2009-7-21
     */
    $.fn.Pager = function (opt) {
        var _defaultopt = {
            pagesize:10,
            nowpage:1,
            recordcount:100,
            url:window.location.href.toString(),
            pageparameter:"page",
            config:"default"
        };
        var _opt = $.extend(_defaultopt, opt || {});
        return this.each(function () {
            var _config = _configall[_opt.config] || _configall["default"];
            _config.handle(_config.template, $(this), _opt);
        });
    };
})(jQuery);

(function ($) {
    MAJAXBUSY = false;
    var cfg_word = {"23":"快长大吧！",
        "20":"虎年能吃能赚！",
        "26":"其实。。那个。。",
        "27":"赚钱千日供此浪漫一时！",
        "28":"赶快给换上！",
        "29":"这只是开始！",
        "30":"洗洗更健康！",
        "31":"总入不敷出也不行！",
        "32":"要有房！要有车！",
        "33":"放下武器，舍身成佛！"}
    mCsend = function (def) {
        if (MAJAXBUSY)return;
        MAJAXBUSY = true;
        $.post("/goods/ajax.php", {act:"htmlsentgift", typeid:19}, function (d) {
            MAJAXBUSY = false;
            var obj = mAlert(d.html, "赠送礼物",function () {
                if (MAJAXBUSY)return;
                if (typeof(def) == "undefined" && obj.find("input.input_viled").length == 0) {
                    return "请选择粉丝";
                }
                if (obj.find("li.on").length == 0) {
                    return "请选择礼物";
                }
                var _toid = "";
                if (def) {
                    _toid = def;
                }
                else {
                    _toid = $("#ipt_fans").data("val");
                }
                var _gid = obj.find("li.on").attr("gid");
                var _txt = obj.find("textarea").val();
                var _anony = obj.find(":checked").length;
                MAJAXBUSY = true;
                $.post("/goods/ajax.php", {act:"sendgift", "touid":_toid, "gid":_gid, msg:_txt, anony:_anony}, function (d) {
                    MAJAXBUSY = false;
                    if (d.ret == 1) {
                        mTinyAlert(d.msg);
                        if (window.location.href.toString().indexOf("http://www.mafengwo.cn/u/") == 0) {
                            setTimeout(function () {
                                window.location.reload();
                            }, 1500);
                        }
                    }
                    else {
                        majaxerr(d);
                    }
                }, "json");
                return true;

            }).css({width:"500px", marginLeft:"-250px", position:"absolute", top:"17%"});

            obj.find("li").click(function () {
                obj.find("li.on").removeClass("on");
                $(this).addClass("on");
                var gid = $(this).attr("gid");
                if (obj.find("textarea").hasClass("gray")) {
                    if (cfg_word[gid]) {
                        obj.find("textarea").unbind("focus");
                        obj.find("textarea").unbind("blur");
                        obj.find("textarea").val(cfg_word[gid]).inputDefault({text:cfg_word[gid]});
                    }
                    ;
                }
            });
            obj.find("textarea").inputDefault({text:"哥送的不是礼物，是寂寞！"});
            if (def) {
                $("#ipt_fans").parent().parent().hide();
            }
            else {
                $("#ipt_fans").suggest("/ajax/ajax_suggest.php?type=fans");
            }
        }, "json");
    };
    mGetGift = function (ugid) {
        if (MAJAXBUSY)return;
        MAJAXBUSY = true;
        jQuery.post("/goods/ajax.php", {act:"getgift", "ugid":ugid}, function (d) {
            MAJAXBUSY = false;
            if (d.ret == 1) {
                if (d.msg == "key555") {
                    mAlert("恭喜，从" + d.html + "里掏出了铜钥匙！");
                } else if (d.msg == "key888") {
                    mAlert("恭喜，从" + d.html + "里掏出了金钥匙！");
                } else {
                    mAlert("恭喜，从" + d.html + "里掏出" + d.msg + "金币！");
                }

            }
            else {
                majaxerr(d);
            }
        }, "json");
    };
    mGapple = function () {
        if (MAJAXBUSY)return;
        MAJAXBUSY = true;
        jQuery.post("/goods/ajax.php", {act:"apple"}, function (d) {
            MAJAXBUSY = false;
            if (d.ret == 1) {
                mAlert("恭喜您成功领取平安果和18888金币，在此马蜂窝全体圣斗士祝您平安夜快乐，圣诞快乐！", "领取成功", function () {
                    window.location.reload();
                });
                jQuery("#popup_close").hide();
            }
            else {
                majaxerr(d);
            }
        }, "json");
    };
})(jQuery);
//圣诞树
jQuery(function () {
    jQuery("#pnl_xmastree").unbind("click");
    jQuery("#pnl_xmastree").click(function () {
        if (jQuery("#pnl_xmastree").data("click")) {
            ;
        }
        else {
            jQuery("#pnl_xmastree").data("click", true);
            var _ugid = jQuery(this).attr("tid");
            jQuery.post("/goods/ajax.php", {act:"yao", "ugid":_ugid}, function (d) {
                if (d.ret == 1) {
                    if (typeof(xnfeed) == "function") {
                        xnfeed();
                    }
                    ;
                    mAlert("恭喜，你摇出了" + d.msg + "金币！");
                } else if (d.ret == 3) {
                    mConfirm("只有粉丝才能摇TA家的树，现在就成为TA的粉丝吧？", function (r) {
                        if (r)
                            jQuery.post("/ajax/addfriend.php", {action:"addfollow", type:"attfri", touid:d.msg, '_need_cstk':true}, function (data) {
                                if (data.ret == 1) {
                                    mTinyAlert("操作成功！");
                                }
                                else {
                                    majaxerr(data);
                                }
                            }, "json");
                    }, "成为TA的粉丝");

                }
                else {
                    majaxerr(d);
                }
                jQuery("#pnl_xmastree").data("click", false);
            }, "json");
        }

    });
});
//文章滚动插件
Scroll = function (option) {
    this.oNote = jQuery("#" + option.elid) || null;
    this.height = option.lineHeight || 15;
    this.count = option.displayCount || 1;
    this.delay = option.delay || 5;
    this.delay = (this.delay || 1) * 1000;
    this.interval = new Array();
    this.scrollNum = option.scrollNum || this.count;
    this.scrollHeight = this.height * this.scrollNum;
    this.oHeight = this.height * this.count;
    this.ctrl = option.ctrl || null;
    this.running = false;
    this.init();
};
Scroll.prototype = {
    start:function (isdown) {
        var self = this;
        if (this.oNote.attr("scrollHeight") - this.oHeight <= this.oNote.attr("scrollTop")) {
            this.oNote.attr("scrollTop", this.oNote.attr("scrollHeight") / 2 - this.oHeight);
        }
        this.clear_interval(1);
        this.interval[1] = setInterval(function () {
            self.scroll_note(isdown);
        }, 5);
    },
    scroll_note:function (isdown) {
        if (isdown) {
            this.oNote[0].scrollTop++;
        }
        else {
            this.oNote[0].scrollTop--;
        }
        this.running = true;
        if (this.oNote[0].scrollTop % this.scrollHeight == 0) {
            this.clear_interval(1);
            this.running = false;

        }
    },
    set_interval:function () {
        var self = this;
        this.interval[0] = setInterval(function () {
            self.start(true);
        }, this.delay);
    },
    clear_interval:function (i) {
        clearInterval(this.interval[i]);
    },
    init:function () {
        var self = this;
        var html = this.oNote.html();
        this.oNote.html(html + html);
        this.oNote.css("height", this.oHeight);
        this.oNote.css("overflow", "hidden");
        this.oNote.css("padding", "0px");
        this.oNote.find("li").css("margin", "0px");
        this.oNote.attr("scrollTop", "0px");
        if (this.oNote.attr("scrollHeight") > this.oHeight) {
            this.oNote.mouseover(function () {
                self.clear_interval(0);
            });
            this.oNote.mouseout(function () {
                self.set_interval();
            });
            if (this.ctrl) {
                this.ctrl[0].mouseover(function () {
                    self.clear_interval(0);
                });
                this.ctrl[0].mouseout(function () {
                    self.set_interval();
                });
                this.ctrl[1].mouseover(function () {
                    self.clear_interval(0);
                });
                this.ctrl[1].mouseout(function () {
                    self.set_interval();
                });

                this.ctrl[0].click(function () {
                    self.start(false);
                });
                this.ctrl[1].click(function () {
                    self.start(true);
                });
            }
            this.set_interval();
        }
        else {
            if (this.ctrl) {
                this.ctrl[0].hide();
                this.ctrl[1].hide();
            }
        }
    }
};

//消息滚动
jQuery(function () {
    if (!jQuery("#pnl_notice").is(':visible')) {
        jQuery("#pnl_notice").show();
        new Scroll({elid:"pnl_notice", lineHeight:25, scrollNum:1});
    }
});
//图片记载
(function ($) {
    $.fn.LoadImage = function (settings) {
        settings = $.extend({
            loadpic:"",
            w:530, h:350
        }, settings);
        return this.each(function () {
            $.fn.LoadImage.Showimg($(this), settings);
        });
    };
    $.fn.LoadImage.Showimg = function ($this, settings) {
        var src = $this.attr("src");
        var img = new Image();
        img.src = src;
        $this.attr("src", "");
        var loading = $("<div><img width=\"" + settings.w + "\" height=\"" + settings.h + "\" src=\"" + settings.loadpic + "\" /><img src=\"http://file.mafengwo.cn/images/plugins/loading_blue.gif\" /></div>").appendTo($("body")).css({position:"absolute", top:$this.offset().top, left:$this.offset().left});
        $this.hide();
        if (!img.complete) {
            jQuery(img).bind('error load onreadystatechange', function () {
                loading.remove();
                $this.attr("src", src);
                $this.show();
            });
        } else {
            loading.remove();
            $this.attr("src", src);
            $this.show();
        }
    }
})(jQuery);

//poke
var mfw_poke = function (uid) {
    var obj = mAlert('<label style="cursor:pointer" for="pokeitem_1"><input id="pokeitem_1" type="radio" checked="checked" value="对你说“很高兴认识你”" name="acttype"><img src="http://images.mafengwo.net/images/home/poke/i1.gif">很高兴认识你</label><label style="cursor:pointer" for="pokeitem_2"><input value="向你打招呼" id="pokeitem_2" type="radio" name="acttype"><img src="http://images.mafengwo.net/images/home/poke/i2.gif">打招呼</label><label style="cursor:pointer" for="pokeitem_3"><input  value="同你握了下手" id="pokeitem_3" type="radio" name="acttype"><img src="http://images.mafengwo.net/images/home/poke/i3.gif">握手</label><label style="cursor:pointer" for="pokeitem_4"><input value="聊聊" id="pokeitem_4" type="radio" name="acttype"><img src="http://images.mafengwo.net/images/home/icon_7.gif">聊聊</label><div id="pnl_pokechat" class="hide"><br>说点什么：<br><textarea style="width:200px;height:50px"></textarea></div>', "打个招呼", function () {
        var msg = jQuery.trim(obj.find(":checked").val());
        //alert(msg);
        if (msg == "聊聊") {
            var _content = jQuery.trim(jQuery("#pnl_pokechat textarea").val());
            if (_content.length > 0)
                jQuery.post("/ajax/ajax_send.php", {touid:uid, type:"msg", content:_content, _need_cstk:true}, function (d) {
                    if (d.ret == 1) {
                        mTinyAlert(d.msg);
                    } else {
                        majaxerr(d);
                    }
                }, "json");
            else
                return "说点什么吧！";
        }
        else {
            jQuery.post("/ajax/ajax_poke.php", {touid:uid, msg:msg, act:"poke"}, function (d) {
                if (d.ret == 1) {
                    mTinyAlert(d.msg);
                } else {
                    majaxerr(d);
                }
            }, "json");
        }
    }, -1);
    obj.find(":radio").click(function () {
        if (jQuery(this).attr("id") == "pokeitem_4")
            jQuery("#pnl_pokechat").removeClass("hide");
        else
            jQuery("#pnl_pokechat").addClass("hide");
    });
    jQuery(".pop-ctn").addClass("pop-con").removeClass("pop-ctn");
}
//pop
mPop = function (content, title, ctrl, overlay) {
    mPop.GUID++;
    this.content = content;
    this.title = title || "提示";
    this.ctrl = ctrl || {"确定":""};
    this.overlay = overlay || false;
    this.id = "mPop" + mPop.GUID;
    this.obj = jQuery(mPop.prototype.tpl).appendTo("body").attr("id", this.id);
    this.init();
    return this;
}
mPop.prototype.tpl = '<div class="p_w"><div class="p_c"><h3><span class="_t"></span></h3><div class="ct"><p class="_p"></p></div><a href="javascript:void(0)" class="c _c" title="关闭">关</a><div class="b _b"></div></div><div class="bg"></div></div>';
mPop.prototype.init = function () {
    var s = this;
    this.updateT(this.title);
    this.updateP(this.content);
    this.updateB(this.ctrl);
    this.obj.find("._c").click(function () {
        s.hide();
    });
    if (this.overlay)$.alerts._overlay('show');
    mPop.list[this.id] = this.obj;
};
mPop.prototype.close = function () {
    this.obj.remove();
    mPop.list[this.id] = null;
    if (this.overlay)$.alerts._overlay('hide');
};
mPop.prototype.hide = function () {
    this.obj.hide();
    if (this.overlay)$.alerts._overlay('hide');
};
mPop.prototype.updateP = function (p) {
    this.obj.find("._p").html(p);
};
mPop.prototype.updateT = function (t) {
    this.obj.find("._t").html(t);
};
mPop.prototype.updateB = function (b) {
    this.obj.find("._b").html("");
    for (var k in b) {
        var btn = jQuery('<button type="button">' + k + '</button>').appendTo(this.obj.find("._b"));
        if (typeof(b[k]) == "function") {
            btn.click(function () {
                b[k](btn);
            });
        } else {
            btn.click(this.hide);
        }
    }
};
mPop.closeAll = function () {
    for (var k in mPop.list) {
        mPop.list[k].remove();
        mPop.list[k] = null;
    }
}
mPop.prototype.hideC = function () {
    this.obj.find("._c").remove()
};
mPop.GUID = 0;
mPop.list = {};

(function ($) {
    var opt;

    $.fn.seekIterate = function (i) {
        var $els = this;
        $els.eq(i).seekExecute();
        setTimeout(function () {
            if (i < $els.length - 1) {
                $els.seekIterate(i + 1);
            }
        }, opt.multiple.interval);
    }

    $.fn.seekExecute = function () {
        this.each(function (i) {
            var $el = jQuery(this);
            var $startFrom = opt.startFrom;
            var $hi = $("<div id='divHilight" + i + "' />");

            $hi.css({   width:$startFrom[0] == window ? $startFrom.width() - 10 : $startFrom.outerWidth(),
                height:$startFrom[0] == window ? $startFrom.height() - 10 : $startFrom.outerHeight(),
                "background-color":opt.css.backgroundColor,
                "border-color":opt.css.borderColor,
                "border-style":opt.css.borderStyle,
                "border-width":opt.css.borderWidth,
                position:"absolute",
                top:$startFrom[0] == window ? 0 : $startFrom.offset().top,
                bottom:0,
                right:0,
                left:$startFrom[0] == window ? 0 : $startFrom.offset().left,
                padding:"0px" })
                .appendTo("body")
                .animate({  top:$el.offset().top - $hi.css("border-top-width").replace("px", ""),
                    left:$el.offset().left - $hi.css("border-left-width").replace("px", ""),
                    width:$el.outerWidth(),
                    height:$el.outerHeight() },
                opt.animation.speed,
                opt.animation.easeFunction,
                function () {

                    $hi.animate({ opacity:"0"}, 200)
                        .animate({ opacity:'1' }, 200)
                        .animate({ opacity:'0' }, 200)
                        .animate({ opacity:'1' }, 200)
                        .animate({ opacity:"0" }, 200, function () {
                            $hi.remove();
                        });

                });
        });
    }

    $.fn.seek = function (options) {
        opt = $.extend({}, $.fn.seek.defaults, options);
        if (options && options.css) {
            opt.css = $.extend({}, $.fn.seek.defaults.css, options.css);
        }
        if (options && options.animation) {
            opt.animation = $.extend({}, $.fn.seek.defaults.animation, options.animation);
        }
        if (options && options.multiple) {
            opt.multiple = $.extend({}, $.fn.seek.defaults.multiple, options.multiple);
        }

        var $els = this;

        if (opt.multiple.simultaneous) {
            $els.not(opt.startFrom).seekExecute();
        }
        else {
            $els.not(opt.startFrom).seekIterate(0);
        }
    }

    $.fn.seek.defaults = {
        css:{  backgroundColor:"Transparent",
            borderColor:"#ff4444",
            borderStyle:"solid",
            borderWidth:"1px",
            position:"absolute",
            top:0,
            bottom:0,
            right:0,
            left:0 },
        startFrom:$(window),
        animation:{ easeFunction:"swing",
            speed:500 },
        multiple:{ simultaneous:true,
            interval:800 }
    };
})(jQuery);


function copyToClipboard(txt) {
    if (window.clipboardData) {
        window.clipboardData.clearData();
        window.clipboardData.setData("Text", txt);
    } else if (navigator.userAgent.indexOf("Opera") != -1) {
        window.location = txt;
    } else if (window.netscape) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        } catch (e) {
            mAlert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip)
            return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans)
            return;
        trans.addDataFlavor('text/unicode');
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = txt;
        str.data = copytext;
        trans.setTransferData("text/unicode", str, copytext.length * 2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip)
            return false;
        clip.setData(trans, null, clipid.kGlobalClipboard);
        mAlert("复制成功")
    }
}
var newMessageRemind = {
    _step:0,
    _actived:true,
    _title:document.title,
    _timer:null,
    //显示新消息提示
    show:function (title) {
        var title = title || "通知";
        var temps = newMessageRemind._title.replace("【　　　】", "").replace("【新" + title + "】", "");
        newMessageRemind._timer = setTimeout(function () {
            newMessageRemind.show(title);
            //这里写Cookie操作
            newMessageRemind._step++;
            if (newMessageRemind._step == 3) {
                newMessageRemind._step = 1
            }
            ;
            if (newMessageRemind._step == 1) {
                document.title = "【　　　】" + temps
            }
            ;
            if (newMessageRemind._step == 2) {
                document.title = "【新" + title + "】" + temps
            }
            ;
        }, 800);
        return [newMessageRemind._timer, newMessageRemind._title];
    },
    //取消新消息提示
    clear:function () {
        clearTimeout(newMessageRemind._timer);
        document.title = newMessageRemind._title;
        //这里写Cookie操作
    }

};

jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) {
        return s;
    } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

function jb(title) {
    var obj = mAlert('<textarea id="pnl_jubao" style="width:370px;height:60px;"></textarea>', "填写举报原因", function () {
        var _content = jQuery.trim(jQuery("#pnl_jubao").val());
        if('' == _content) {
            return '请填写举报原因！';
        } else {
            var content = title + ' 举报原因：' + _content;
            jQuery.post("/ajax/ajax_msg.php", {a:"jubao", c:content}, function (d) {
                if (d.ret == 1) {
                    mTinyAlert("举报成功");
                } else {
                    mTinyAlert("举报失败");
                }
            }, "json");
        }
    });
}

function mf(settings) {
    var settings = $.extend(mf.settings, settings);
    var pnl = $("<div class='" + settings.baseCLS + "'>" + settings.content + "</div>")
        .appendTo($('body'))
        .css({"width":settings.width + "px", "marginLeft":"-" + settings.width / 2 + "px", "left":"50%", zIndex:1000});
    pnl.find("." + settings.closeCLS)
        .click(function () {
            settings.onClose ? settings.onClose.call(pnl) : pnl.remove();
            $.alerts._overlay('hide');
        });
    $.alerts._overlay('show');
    mf.last.pnl = pnl;
    mf.last.settings = settings;
    return pnl;
}
;
mf.settings = {
    content:'About mf:a simple float panel!<a class="close">close</a><br>\
            content:"your content",<br/>\
            width:your panel`s width,default is 200<br/>\
            zIndex:your panel`s zIndex,default is 1000<br/>\
            baseCLS:your panel classame,default is "mf"<br/>\
            closeCLS:the close action base on, default is "close"<br/><br/>\
            close API is: mf.close();<br/>\
            Css Demo:<br/>.fm{position:fixed;top:17%;}<br/>\
            * html .fm{position: absolute;top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + "px");}\
            ',
    width:400,
    zIndex:1000,
    baseCLS:"mf",
    closeCLS:"close",
    onClose:false
}
mf.close = function () {
    if (mf.last) {
        mf.last.settings.onClose ? mf.last.settings.onClose.call(mf.last.pnl) : mf.last.pnl && mf.last.pnl.remove();
    }
    $.alerts._overlay('hide');
}
mf.last = {};
function show_pop_html(obj, marginleft_px, index) {
    $.alerts._overlay('hide');
    obj.css("top", '10%');
    obj.css("left", '50%');
    obj.css("marginLeft", "-" + marginleft_px + "px");
    obj.css("marginTop", ($(window).scrollTop() + 50) + "px");
    obj.css("position", 'absolute');
    if (index)
        obj.css("zIndex", index);
    else
        obj.css("zIndex", '1001');
    $.alerts._overlay('show');
    obj.removeClass('hide');
}
function close_pop_html(obj) {
    $.alerts._overlay('hide');
    obj.addClass('hide');
}

function active_weng() {

    if (!$.cookie("SHOW_ACTIVE_WENG", {path:'/'})) {

        var html = '<div class="wengComing_close"><a id="btn_wengnew_close" title="关闭" href="javascript:;">关闭</a></div>\
                        <div class="wengComing">\
                            <a target="_blank" href="http://www.mafengwo.cn/i/914893.html">嗡嗡来了</a>\
                        </div>'
        $('body').append(html);
        $.alerts.overlayOpacity = .9;
        $.alerts._overlay('show');
        $("#btn_wengnew_close").click(function () {
            $(this).parent().next().remove().end().remove();
            $.alerts._overlay('hide');
            $.cookie("SHOW_ACTIVE_WENG", true, { expires:1, path:'/', domain:'mafengwo.cn'});
        });
    }

}

function add_op_log(type, key, subkey, params, ip, uid, uuid, rtime) {
    $.post('/ajax/ajax_logs.php', {
        action: 'add_op_logs',
        type: type,
        key: key,
        subkey: subkey,
        ip: ip,
        uid: uid,
        uuid: uuid,
        rtime: rtime,
        params: params
    }, null, 'json');
}

function parse_url(url) {
    var patten = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,
        result = patten.exec(url),
        keys = ['url', 'fragment', 'protocol', false, 'username', 'password', 'host', 'port', 'pathname', 'querystring'],
        obj = new Object();

    for(var i = 0; i < keys.length; i++) {
        if(!keys[i]) {
            continue;
        }
        if(result && result[i]){
            obj[keys[i]] = result[i]
        }else{
            obj[keys[i]] = '';
        }
    }
    return obj;
}

(function($){
    $.fn.hoverDelay = function(options){
        var defaults = {
            hoverDuring: 350,
            outDuring: 150,
            hoverEvent: function(){
                $.noop();
            },
            outEvent: function(){
                $.noop();
            }
        };
        var sets = $.extend(defaults,options || {});
        var hoverTimer, outTimer, that = this;
        return $(this).each(function(){
            $(this).hover(function(){
                clearTimeout(outTimer);
                hoverTimer = setTimeout(function(){sets.hoverEvent.apply(that)}, sets.hoverDuring);
            },function(){
                clearTimeout(hoverTimer);
                outTimer = setTimeout(function(){sets.outEvent.apply(that)}, sets.outDuring);
            });
        });
    }
})(jQuery);

(function($) {
    $.mfwplugins = {
        emotions: [
            {title: '大笑', file: 'http://images.mafengwo.net/images/i/face/1.gif'},
            {title: '微笑', file: 'http://images.mafengwo.net/images/i/face/2.gif'},
            {title: '亲亲', file: 'http://images.mafengwo.net/images/i/face/3.gif'},
            {title: '抱抱', file: 'http://images.mafengwo.net/images/i/face/4.gif'},
            {title: '色色', file: 'http://images.mafengwo.net/images/i/face/5.gif'},
            {title: '好失望哟', file: 'http://images.mafengwo.net/images/i/face/6.gif'},
            {title: '好困哦', file: 'http://images.mafengwo.net/images/i/face/7.gif'},
            {title: '害羞', file: 'http://images.mafengwo.net/images/i/face/8.gif'},
            {title: '酷呆了', file: 'http://images.mafengwo.net/images/i/face/9.gif'},
            {title: '晕倒', file: 'http://images.mafengwo.net/images/i/face/10.gif'},
            {title: '眨眼', file: 'http://images.mafengwo.net/images/i/face/11.gif'},
            {title: '鬼脸', file: 'http://images.mafengwo.net/images/i/face/12.gif'},
            {title: '小声点', file: 'http://images.mafengwo.net/images/i/face/13.gif'},
            {title: '吃惊', file: 'http://images.mafengwo.net/images/i/face/14.gif'},
            {title: '翻白眼', file: 'http://images.mafengwo.net/images/i/face/15.gif'},
            {title: '干杯', file: 'http://images.mafengwo.net/images/i/face/16.gif'},
            {title: '困惑', file: 'http://images.mafengwo.net/images/i/face/17.gif'},
            {title: '啥？', file: 'http://images.mafengwo.net/images/i/face/18.gif'},
            {title: '睡觉', file: 'http://images.mafengwo.net/images/i/face/19.gif'},
            {title: '再见了', file: 'http://images.mafengwo.net/images/i/face/20.gif'},
            {title: '眼泪哗哗地', file: 'http://images.mafengwo.net/images/i/face/21.gif'},
            {title: '你好讨厌', file: 'http://images.mafengwo.net/images/i/face/22.gif'},
            {title: '我吐', file: 'http://images.mafengwo.net/images/i/face/23.gif'},
            {title: '怒骂', file: 'http://images.mafengwo.net/images/i/face/24.gif'},
            {title: '闭嘴', file: 'http://images.mafengwo.net/images/i/face/25.gif'},
            {title: '打你', file: 'http://images.mafengwo.net/images/i/face/26.gif'},
            {title: '真的生气了', file: 'http://images.mafengwo.net/images/i/face/27.gif'},
            {title: '超级棒', file: 'http://images.mafengwo.net/images/i/face/28.gif'},
            {title: '不咋地', file: 'http://images.mafengwo.net/images/i/face/29.gif'},
            {title: '魅力四射', file: 'http://images.mafengwo.net/images/i/face/30.gif'},
            {title: '心都碎了', file: 'http://images.mafengwo.net/images/i/face/31.gif'},
            {title: '爱', file: 'http://images.mafengwo.net/images/i/face/32.gif'},
            {title: '吻', file: 'http://images.mafengwo.net/images/i/face/33.gif'},
            {title: '玫瑰凋谢了', file: 'http://images.mafengwo.net/images/i/face/34.gif'},
            {title: '玫瑰盛开了', file: 'http://images.mafengwo.net/images/i/face/35.gif'},
            {title: '生日蛋糕', file: 'http://images.mafengwo.net/images/i/face/36.gif'},
            {title: '礼物', file: 'http://images.mafengwo.net/images/i/face/37.gif'},
            {title: '苹果', file: 'http://images.mafengwo.net/images/i/face/38.gif'},
            {title: '西瓜', file: 'http://images.mafengwo.net/images/i/face/39.gif'},
            {title: '咖啡', file: 'http://images.mafengwo.net/images/i/face/40.gif'},
            {title: '足球', file: 'http://images.mafengwo.net/images/i/face/41.gif'},
            {title: '握手', file: 'http://images.mafengwo.net/images/i/face/42.gif'},
            {title: '星星', file: 'http://images.mafengwo.net/images/i/face/43.gif'},
            {title: '精灵', file: 'http://images.mafengwo.net/images/i/face/44.gif'},
            {title: '小丑', file: 'http://images.mafengwo.net/images/i/face/45.gif'},
            {title: '大怒', file: 'http://images.mafengwo.net/images/i/face/46.gif'},
            {title: '生病了', file: 'http://images.mafengwo.net/images/i/face/47.gif'},
            {title: '小可爱', file: 'http://images.mafengwo.net/images/i/face/48.gif'},
            {title: '小心非典', file: 'http://images.mafengwo.net/images/i/face/49.gif'},
            {title: '嘴馋了', file: 'http://images.mafengwo.net/images/i/face/50.gif'},
            {title: '警察', file: 'http://images.mafengwo.net/images/i/face/51.gif'},
            {title: '抓狂了', file: 'http://images.mafengwo.net/images/i/face/52.gif'},
            {title: '不爽', file: 'http://images.mafengwo.net/images/i/face/53.gif'},
            {title: '汗', file: 'http://images.mafengwo.net/images/i/face/54.gif'},
            {title: '思考中', file: 'http://images.mafengwo.net/images/i/face/55.gif'},
            {title: '见钱眼开', file: 'http://images.mafengwo.net/images/i/face/56.gif'},
            {title: '呲牙咧嘴', file: 'http://images.mafengwo.net/images/i/face/57.gif'},
            {title: '晕头转向', file: 'http://images.mafengwo.net/images/i/face/58.gif'},
            {title: '好好爱你哦', file: 'http://images.mafengwo.net/images/i/face/59.gif'},
            {title: '猪头', file: 'http://images.mafengwo.net/images/i/face/60.gif'},
            {title: '便便', file: 'http://images.mafengwo.net/images/i/face/61.gif'},
            {title: '月亮', file: 'http://images.mafengwo.net/images/i/face/62.gif'},
            {title: '音乐', file: 'http://images.mafengwo.net/images/i/face/63.gif'},
            {title: '饭', file: 'http://images.mafengwo.net/images/i/face/64.gif'},
            {title: '真衰', file: 'http://images.mafengwo.net/images/i/face/65.gif'},
            {title: '偷笑', file: 'http://images.mafengwo.net/images/i/face/66.gif'},
            {title: '下雨', file: 'http://images.mafengwo.net/images/i/face/67.gif'},
            {title: '猫猫', file: 'http://images.mafengwo.net/images/i/face/68.gif'},
            {title: '狗狗', file: 'http://images.mafengwo.net/images/i/face/69.gif'},
            {title: '骷髅', file: 'http://images.mafengwo.net/images/i/face/70.gif'},
            {title: '书呆子', file: 'http://images.mafengwo.net/images/i/face/71.gif'},
            {title: '太阳', file: 'http://images.mafengwo.net/images/i/face/72.gif'},
            {title: '邮件', file: 'http://images.mafengwo.net/images/i/face/73.gif'},
            {title: '帅帅男孩', file: 'http://images.mafengwo.net/images/i/face/74.gif'},
            {title: '妩媚女孩', file: 'http://images.mafengwo.net/images/i/face/75.gif'},
            {title: '药丸', file: 'http://images.mafengwo.net/images/i/face/76.gif'},
            {title: '鄙视', file: 'http://images.mafengwo.net/images/i/face/77.gif'},
            {title: '烧香', file: 'http://images.mafengwo.net/images/i/face/78.gif'}
        ],
        callusers: {},
        buildGotop: function() {
            if($('.m-gotopbtn').size() > 0) {
                return false;
            }
            $('<div class="m-gotopbtn"><a href="javascript:void(0);" hidefocus="true" title="飞回顶部" rel="nofollow"></a></div>')
                .find('a').bind('click', function() {
                    $('html,body').animate({
                        scrollTop: 0
                    }, 500);
                }).end().appendTo($('body'));
            $(window).bind('scroll', function() {
                if($(document).scrollTop() > 500) {
                    if($('.m-gotopbtn a').position().top == 100) {
                        $('.m-gotopbtn a').animate({top: -95}, 300);
                    }
                } else {
                    if($('.m-gotopbtn a').position().top == -95) {
                        $('.m-gotopbtn a').animate({top: 100}, 300);
                    }
                }
            });
        },
        /*dropZ: function() {
         for(var i = 0; i < 16; i ++) {
         var key = Math.floor(Math.random() * 8 + 1), //取1-8随机数
         itemZ = $('<div class="zz_icon' + key + '"></div>').css({
         'z-index': 9999,
         'top': -400 + Math.random() * 300,
         'left': Math.random() * ($(window).width() - 74)
         }).appendTo($('body'));
         itemZ.animate({
         top: $(window).height() - 74,
         translate3d: '0,10px,0'
         }, 2300 * Math.random() + $(window).height() * 1.5, '', function() {
         $(this).fadeOut(300, function() {
         $(this).remove();
         });
         });
         }
         },*/
        showClosing: function(startTime, endTime, callback, btnText) {
            if(startTime >= endTime) {
                return;
            }
            var start_date = new Date(startTime),
                end_date = new Date(endTime),
                start_day = start_date.getFullYear() + '.' + (start_date.getMonth() + 1) + '.' + start_date.getDate(),
                end_day = end_date.getFullYear() + '.' + (end_date.getMonth() + 1) + '.' + end_date.getDate(),
                start_time = start_date.getHours() + ':' + start_date.getMinutes(),
                end_time = end_date.getHours() + ':' + end_date.getMinutes(),
                start_text, end_text;
            start_text = start_day + ' ' + start_time;
            if(start_day == end_day) {
                end_text = end_time;
            } else {
                end_text = end_day + ' ' + end_time;
            }
            btnText = (undefined != btnText && null != btnText) ? btnText : '确定';
            if('function' == typeof callback) {
                callback = function() {
                    callback();
                };
            } else {
                btnText = '返回首页';
                callback = function() {
                    location.href = '/';
                };
            }
            mAlert('<div class="weihu">' + start_text + ' 至 ' + end_text + '</div>', '', callback, -1, true);
            $('#popup_ok').val(btnText);
        }
    };

    $.mfwfeed = {
        /**
         * 开放平台类型
         */
        keys: {
            weibo: 'wb',
            qzone: 'qz',
            qweibo: 'qt',
            renren: 'rr'
        },
        /**
         * 用户设置类型
         */
        types: {
            type_w: 'weng',
            type_ap: 'a_piblic',
            type_ar: 'a_reply',
            type_ac: 'activity',
            type_f: 'feed'
        },
        /**
         * @name 添加开放平台分享任务
         * @param key 开放平台类型
         * @param title 分享标题
         * @param content 分享内容
         * @param image 分享图片
         * @param url 分享链接
         * @param comment 分享原因
         * @param type 用户设置类型
         * @param triggerUrl 触发URL
         * @param callback 回调方法
         */
        addFeedTask: function(key, title, content, image, url, comment, type, triggerUrl, callback) {
            if('undefined' == typeof(triggerUrl) || null == typeof(triggerUrl) || '' == triggerUrl) {
                triggerUrl = location.href;
            }
            var feed_data = {
                key: key,
                title: title,
                content: content,
                image: image,
                url: url,
                comment: comment,
                type: type
            };
            $.post('/ajax/ajax_user_task.php', {
                act: 'add_task',
                type: 'sf',
                data: $.toJSON(feed_data),
                url: triggerUrl
            }, function(d) {
                if('function' == typeof callback) {
                    callback();
                }
            }, 'json');
        },
        manageFeedTask: function(triggerUrl, callback) {
            if('undefined' == typeof(triggerUrl) || null == typeof(triggerUrl) || '' == triggerUrl) {
                triggerUrl = location.href;
            }
            $.post('/ajax/ajax_user_task.php', {
                act: 'manage_task',
                type: 'sf',
                url: triggerUrl
            }, function(d) {
                if('function' == typeof callback) {
                    callback(d);
                } else {
                    if(d.no == 1) {
                        mAlert('分享成功');
                    } else {
                        mAlert('分享失败');
                    }
                }
            })
        }
    };
})(jQuery);
jQuery(function() {
    //$.mfwfeed.manageFeedTask();
});

//类扩展
String.prototype.showStr = function(length, ext) {
    var showStr = '';
    var showLength = 0;
    var hasMore = false;
    for(var i = 0, j = this.length; i < j; i++) {
        var singleChar = this.charAt(i);
        var singleCharSize = 0;
        if(escape(singleChar).length > 4) {
            singleCharSize = 2;
        } else {
            singleCharSize = 1;
        }
        if(showLength + singleCharSize > length) {
            if(i !== j) {
                hasMore = true;
            }
            break;
        } else {
            showStr += singleChar;
            showLength += singleCharSize;
        }
    }
    if(!!ext && hasMore) {
        while((showLength + ext.length) > length) {
            var chars = showStr.split('');
            var lastChar = chars.pop();
            if(escape(lastChar).length > 4) {
                showLength -= 2;
            } else {
                showLength --;
            }
            showStr = chars.join('');
        }
        showStr += ext;
    }
    return showStr;
};


if (typeof JSON !== 'object') {
    JSON = {};
}

(function () {
    'use strict';

    function f(n) {
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {

        Date.prototype.toJSON = function () {

            return isFinite(this.valueOf())
                ? this.getUTCFullYear()     + '-' +
                f(this.getUTCMonth() + 1) + '-' +
                f(this.getUTCDate())      + 'T' +
                f(this.getUTCHours())     + ':' +
                f(this.getUTCMinutes())   + ':' +
                f(this.getUTCSeconds())   + 'Z'
                : null;
        };

        String.prototype.toJSON      =
            Number.prototype.toJSON  =
                Boolean.prototype.toJSON = function () {
                    return this.valueOf();
                };
    }

    var cx,
        escapable,
        gap,
        indent,
        meta,
        rep;


    function quote(string) {

        escapable.lastIndex = 0;
        return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
            var c = meta[a];
            return typeof c === 'string'
                ? c
                : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
        }) + '"' : '"' + string + '"';
    }


    function str(key, holder) {

        var i,          // The loop counter.
            k,          // The member key.
            v,          // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

        if (value && typeof value === 'object' &&
            typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }


        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }


        switch (typeof value) {
            case 'string':
                return quote(value);

            case 'number':


                return isFinite(value) ? String(value) : 'null';

            case 'boolean':
            case 'null':


                return String(value);


            case 'object':

                if (!value) {
                    return 'null';
                }


                gap += indent;
                partial = [];


                if (Object.prototype.toString.apply(value) === '[object Array]') {


                    length = value.length;
                    for (i = 0; i < length; i += 1) {
                        partial[i] = str(i, value) || 'null';
                    }


                    v = partial.length === 0
                        ? '[]'
                        : gap
                        ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
                        : '[' + partial.join(',') + ']';
                    gap = mind;
                    return v;
                }


                if (rep && typeof rep === 'object') {
                    length = rep.length;
                    for (i = 0; i < length; i += 1) {
                        if (typeof rep[i] === 'string') {
                            k = rep[i];
                            v = str(k, value);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                } else {


                    for (k in value) {
                        if (Object.prototype.hasOwnProperty.call(value, k)) {
                            v = str(k, value);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                }


                v = partial.length === 0
                    ? '{}'
                    : gap
                    ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
                    : '{' + partial.join(',') + '}';
                gap = mind;
                return v;
        }
    }


    if (typeof JSON.stringify !== 'function') {
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
        meta = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        };
        JSON.stringify = function (value, replacer, space) {


            var i;
            gap = '';
            indent = '';


            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }


            } else if (typeof space === 'string') {
                indent = space;
            }


            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                (typeof replacer !== 'object' ||
                    typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }


            return str('', {'': value});
        };
    }



    if (typeof JSON.parse !== 'function') {
        cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
        JSON.parse = function (text, reviver) {



            var j;

            function walk(holder, key) {


                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.prototype.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }



            text = String(text);
            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }


            if (/^[\],:{}\s]*$/
                .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
                    .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
                    .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {



                j = eval('(' + text + ')');



                return typeof reviver === 'function'
                    ? walk({'': j}, '')
                    : j;
            }


            throw new SyntaxError('JSON.parse');
        };
    }
}());
